# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340467 | A_D | Preokret (COCI19_preokret) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
ID: antwand1
TASK: barn1
LANG: C++
*/
#include <bits/stdc++.h>
#define ll long long
#define du long double
#define F first
#define S second
using namespace std;
int a[2];
main()
{
//freopen("barn1.in","r",stdin);freopen("barn1.out","w",stdout);
int n,ti=1,cnt=0,mx=0,ok=0;
cin>>n;
int u=-1;
while(n--){
int k;
cin>>k;k--;
a[k]++;
if(a[0]==a[1])ti++;
if(u==-1||u==k){
cnt++;
}
else{
cnt=1;
ok=0;
}
u=k;
if(cnt>=2&&a[k]==a[k^1]+1){
ok=1;
}
if(ok)mx=max(mx,cnt);
}
cout<<a[0]<<" "<<a[1]<<endl;
cout<<ti<<endl;
cout<<mx<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |