记录编号 |
174714 |
评测结果 |
AAAAAAAA |
题目名称 |
挤牛奶 |
最终得分 |
100 |
用户昵称 |
啊吧啦吧啦吧 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.011 s |
提交时间 |
2015-08-02 17:46:11 |
内存使用 |
1.27 MiB |
显示代码纯文本
/*
ID: jhqwan1
PROG: milk2
LANG: C++11
*/
#include <iostream>
#include <fstream>
using namespace std;
bool qj[1000001] = {false};
int a = 0x7fffffff, n, ans1 = 0, ans2 = 0, b = 0, n1 = 0, n2 = 0;
main()
{
ifstream fin("milk2.in");
ofstream fout("milk2.out");
#define cin fin
#define cout fout
cin >> n;
for (int i = 1; i <= n; ++i){
int x, y;
cin >> x >> y;
for (int j = x; j < y; ++j)
qj[j] = 1;
a = min(a, x);
b = max(b, y);
}
for (int i = a; i < b; ++i){
if (qj[i]){
n1++;
n2 = 0;
}
else{
n1 = 0;
n2++;
}
ans1 = max(ans1, n1);
ans2 = max(ans2, n2);
}
cout << ans1 << ' ' << ans2;
// for(;;);
}