记录编号 |
175585 |
评测结果 |
AAAAAAAAAAAAAAAAAAAAAA |
题目名称 |
[USACO Open12] 奶牛排队 |
最终得分 |
100 |
用户昵称 |
啊吧啦吧啦吧 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.027 s |
提交时间 |
2015-08-06 14:36:04 |
内存使用 |
0.32 MiB |
显示代码纯文本
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
const int MAXN(1001);
int n, ans = 1, b[MAXN];
ifstream fin("cowrow.in");
ofstream fout("cowrow.out");
#define cin fin
#define cout fout
set<int> xl;
main()
{
int nans = 1, nf = 1, last;
cin >> n;
for (int i = 1; i <= n; ++i){
cin >> b[i];
xl.insert(b[i]);
}
fin.close();
for (set<int>::iterator it = xl.begin(); it != xl.end(); ++it){
int i = 1;
nans = nf = 1;
while(i <= n){
if (b[i] == *it){
i++;
continue;
}
last = b[i];
break;
}
i++;
for (; i <= n; ++i){
if (b[i] == *it)
continue;
if (b[i] == last){
nf++;
continue;
}
if (b[i] != last){
last = b[i];
nans = max(nans, nf);
nf = 1;
}
}
ans = max(ans, nans);
}
nans = max(nans, nf);
ans = max(ans, nans);
cout << ans;
fout.close();
// for(;;);
}