# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
811139 | pcc | Preokret (COCI19_preokret) | C++14 | 1 ms | 328 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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
pii score = {0,0};
int ties = 1;
vector<int> v(n);
for(auto &i:v){
cin>>i;
if(i == 1)score.fs++;
else score.sc++;
if(score.fs == score.sc)ties++;
}
vector<pii> vv;
for(auto &i:v){
if(vv.empty()||vv.back().fs != i)vv.push_back({i,1});
else vv.back().sc++;
}
score = {0,0};
int turn = 0;
for(auto &i:vv){
if(i.fs == 1&&score.fs<score.sc&&score.fs+i.sc>score.sc){
turn = max(turn,i.sc);
}
else if(i.fs == 2&&score.sc<score.fs&&score.sc+i.sc>score.fs){
turn = max(turn,i.sc);
}
if(i.fs == 1)score.fs += i.sc;
else score.sc += i.sc;
}
cout<<score.fs<<' '<<score.sc<<'\n'<<ties<<'\n'<<turn;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |