# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554397 | OGheVaySao | Preokret (COCI19_preokret) | C++14 | 1 ms | 308 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;
const int maxn = 1e4;
int n, a[maxn], cnt = 1, maxtwist = 0;
map<int,int> mp;
void pre(){
for(int i = 1; i <= n; i++){
mp[a[i]]++;
if(mp[2] == mp[1]) cnt++;
}
}
void result(){
cout << mp[1] << " " << mp[2] << '\n';
}
void draw(){
cout << cnt << '\n';
}
void twist(){
int st = a[1];
int num = 0;
for(int i = 1; i <= n; i++){
if(a[i] == st) num++;
else{
st = a[i];
maxtwist = max(maxtwist, num);
num = 1;
}
}
maxtwist = max(maxtwist, num);
cout << maxtwist;
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
pre();
result();
draw();
twist();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |