# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
748260 | Trunkty | Preokret (COCI19_preokret) | C++14 | 1 ms | 332 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;
typedef long long ll;
#define int ll
int n,a,b,istie=1,turn;
int arr[255];
vector<int> event;
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
int curr=0,pos=1;
for(int i=1;i<=n;i++){
cin >> arr[i];
if(arr[i]==pos){
curr++;
}
else{
event.push_back(curr);
curr = 1;
pos = arr[i];
}
}
event.push_back(curr);
for(int i=0;i<event.size();i++){
if(event[i]==0){
continue;
}
if(i%2){
if(b<a and b+event[i]>a){
turn = max(turn,event[i]);
}
if(b<a and b+event[i]>=a){
istie++;
}
b += event[i];
}
else{
if(a<b and a+event[i]>b){
turn = max(turn,event[i]);
}
if(a<b and a+event[i]>=b){
istie++;
}
a += event[i];
}
}
cout << a << " " << b << "\n";
cout << istie << "\n";
cout << turn << "\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |