比赛 |
20100926练习 |
评测结果 |
AAWAAAWW |
题目名称 |
挤牛奶 |
最终得分 |
62 |
用户昵称 |
1102 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-09-26 11:31:31 |
显示代码纯文本
- program xxxx;
- var i,j,n,x,y,v,w,c,b,max:longint;
- a:array[-2..1000000] of boolean;
- begin
- assign(input,'milk2.in');
- reset(input);
- assign(output,'milk2.out');
- rewrite(output);
- read(n);
- for i:=0 to n do
- begin
- read(c,b);
- if b>max then
- max:=b;
- for j:=c+1 to b do
- a[j]:=true;
- end;
- for i:=-2 to max do
- if a[i]<>true then
- a[i]:=false;
- for i:=1 to max do
- begin
- if a[i] then
- inc(x)
- else
- inc(y);
- if (a[i]=false)and(a[i-1]=true) then
- begin
- if x>v then
- v:=x;
- x:=0;
- end;
- if (a[i]=true)and(a[i-1]=false) then
- begin
- if y>w then
- w:=y;
- y:=0;
- end;
- end;
- write(v,' ',w);
- close(input);
- close(output);
- end.