<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(255, 255, 255);"><span style="font-size:14px;">var
n,i,b,c,d:longint;
a:real;
begin
assign(input,'oj.in');reset(input);
assign(output,'oj.out');rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(a,b,c,d);
while a>b do
a:=a/10;
if d>c then
writeln('Time Limit Exceeded')
else
if (d<=c)and(a<b) then
writeln('Wrong answer')
else
if (d<=c)and(a=b) then
writeln('Accepted');
end;
close(input);close(output);
end.</span></span>
<span style="background-color: rgb(255, 255, 255);"><span style="font-size:14px;">var
a,b,c,d,num,h:array[0..100000] of longint;
n,i,x,y:longint;
procedure q(l,r:longint);
var
i,j,t,m,m1,m2,m3,m4:longint;
begin
i:=l;
j:=r;
m:=num[(l+r) div 2];
m1:=b[(l+r) div 2];
m2:=d[(l+r) div 2];
m3:=a[(l+r) div 2];
m4:=h[(l+r) div 2];//取每个条件的重点
while i<j do
begin
while (num[i]>m)or((num[i]=m)and(b[i]>m1))or((num[i]=m)and(b[i]=m1)and(d[i]>m2))or((num[i]=m)and(b[i]=m1)and(d[i]=m2)and(a[i]>m3))or((num[i]=m)and(b[i]=m1)and(d[i]=m2)and(a[i]=m3)and(h[i]<m4))do inc(i);
while (num[j]<m)or((num[j]=m)and(b[j]<m1))or((num[j]=m)and(b[j]=m1)and(d[j]<m2))or((num[j]=m)and(b[j]=m1)and(d[j]=m2)and(a[j]<m3))or((num[j]=m)and(b[j]=m1)and(d[j]=m2)and(a[j]=m3)and(h[j]>m4))do dec(j);//一个个比较,注意大于小于符号,这个就是按照条件的优先来排的。
if i<=j then
begin
t:=num[i];
num[i]:=num[j];
num[j]:=t;
t:=h[i];
h[i]:=h[j];
h[j]:=t;
t:=a[i];
a[i]:=a[j];
a[j]:=t;
t:=b[i];
b[i]:=b[j];
b[j]:=t;
t:=c[i];
c[i]:=c[j];
c[j]:=t;
t:=d[i];
d[i]:=d[j];
d[j]:=t;//交换要全部交换完,不要漏掉
inc(i);
dec(j);
end;
end;
if l<j then q(l,j);
if i<r then q(i,r);//跟原先快拍一样
end;
begin
assign(input,'range.in');reset(input);
assign(output,'range.out');rewrite(output);
readln(n,x,y);
for i:=1 to n do
begin
readln(a[i],b[i],c[i],d[i]);
num[i]:=a[i]+b[i]+c[i]+d[i];//总分
h[i]:=i;//序号
end;
q(1,n);
for i:=x to y do
writeln(h[i],' ',num[i]);
close(input);close(output);
end.</span></span>
<span style="background-color: rgb(255, 255, 255);"><span style="font-size:14px;">var
i,n,x,y,s:longint;
begin
assign(input,'paint.in');reset(input);
assign(output,'paint.out');rewrite(output);
readln(n);
for i:=1 to n do
begin
read(x);
if x>y then s:=s+x-y; //<span style="color: rgb(51, 51, 51); font-family: KaiTi_GB2312;font-size:18px;">油漆的次数就是当前围墙高度减去上一个围墙的高度</span>
y:=x; //记录上一个
end;
write(s);
close(input);close(output);
end. </span></span>
<span style="font-size:14px;">var
i:longint;
min,l,r,mid,n,m,ans,max:int64;//一定要用int64,数据太大,无法直视
a:array[0..100000] of longint;
begin
assign(input,'check.in');reset(input);
assign(output,'check.out');rewrite(output);
readln(n,m);
for i:=1 to n do
begin
readln(a[i]);
if a[i]>max then max:=a[i];
end;
r:=max*m;//这个是最大的时间,l=0,我省略了
min:=9000000000000;//题目最大数据的结果就是这个,比maxlongint还大,所以这个要注意一下。
while l<=r do
begin
mid:=(l+r) div 2;
ans:=0;//累加最多能存的人
for i:=1 to n do
ans:=ans+mid div a[i];
if ans>=m then//如果大于m人数或者等于,就判断,然后记录下来,同时r要跟ans>m的情况一样。
begin
if mid<min then min:=mid;
r:=mid-1;
end;
if ans>m then
r:=mid-1
else
if ans<m then
l:=mid+1;//典型二分,多了个累加而已
end;
writeln(min);//输出
close(input);close(output);
end.</span>