# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
811139 |
2023-08-07T01:05:09 Z |
pcc |
Preokret (COCI19_preokret) |
C++14 |
|
1 ms |
328 KB |
#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 |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |