比赛 20100926练习 评测结果 AAWAAAWW
题目名称 挤牛奶 最终得分 62
用户昵称 1102 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-09-26 11:31:31
显示代码纯文本
  1. program xxxx;
  2. var i,j,n,x,y,v,w,c,b,max:longint;
  3. a:array[-2..1000000] of boolean;
  4. begin
  5. assign(input,'milk2.in');
  6. reset(input);
  7. assign(output,'milk2.out');
  8. rewrite(output);
  9. read(n);
  10. for i:=0 to n do
  11. begin
  12. read(c,b);
  13. if b>max then
  14. max:=b;
  15. for j:=c+1 to b do
  16. a[j]:=true;
  17. end;
  18. for i:=-2 to max do
  19. if a[i]<>true then
  20. a[i]:=false;
  21. for i:=1 to max do
  22. begin
  23. if a[i] then
  24. inc(x)
  25. else
  26. inc(y);
  27. if (a[i]=false)and(a[i-1]=true) then
  28. begin
  29. if x>v then
  30. v:=x;
  31. x:=0;
  32. end;
  33. if (a[i]=true)and(a[i-1]=false) then
  34. begin
  35. if y>w then
  36. w:=y;
  37. y:=0;
  38. end;
  39. end;
  40. write(v,' ',w);
  41. close(input);
  42. close(output);
  43. end.