#include <bits/stdc++.h>
using namespace std;
int n,a,b,in[500],t,lws=1,ans;
int main()
{
cin>>n;
for (int i=0;i<n;i++)
{
cin>>in[i];
if (in[i]==1)
a++;
else b++;
if (a==b)
t++;
if (a&&b)
{if (in[i]==in[i-1])
{
lws++;
}
else
{
ans=max(ans,lws);
lws=1;
}}
if (a&&b)
ans=max(ans,lws);
}
cout<<a<<" "<<b<<"\n";
cout <<t+1<<"\n"<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
376 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Partially correct |
1 ms |
364 KB |
Output is partially correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Partially correct |
1 ms |
364 KB |
Output is partially correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |