# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495992 | asandikci | Preokret (COCI19_preokret) | C++17 | 1 ms | 296 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.
#include"iostream"
#include"vector"
// #include"queue"
// #include"deque"
#include"set"
// #include"map"
#include"algorithm"
// #include"iomanip"
// #include"cstring"
#define int long long
using namespace std;
void solve(){
int n;
cin >> n;
int a=0,b=0,tmp,tie=1,turna=0,turnb=0;
bool ta=0,tb=0;
int maxi=0;
for(int i=0;i<n;i++){
cin >> tmp;
if(tmp==1){
if(a<b){
ta=1;
}
if(ta){
turna++;
}
a++;
turnb=0;
tb=0;
maxi = max(maxi,turna);
}
else{
if(b<a){
tb=1;
}
if(tb){
turnb++;
}
turna=0;
ta=0;
b++;
maxi = max(maxi,turnb);
}
if(a==b){
tie++;
}
}
cout << a << " " << b << "\n";
cout << tie << "\n";
cout << maxi <<"\n";
}
signed main(){
// ios::sync_with_stdio(false); cin.tie(0);
// freopen("","r",stdin);freopen("","w",stdout);
int t=1;
// cin >> t;
for(int i=1;i<=t;i++){
// cout << "Case " << i << ":\n";
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |