Submission #554397

#TimeUsernameProblemLanguageResultExecution timeMemory
554397OGheVaySaoPreokret (COCI19_preokret)C++14
44 / 50
1 ms308 KiB
#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 timeMemoryGrader output
Fetching results...