Submission #245277

#TimeUsernameProblemLanguageResultExecution timeMemory
245277OrtPreokret (COCI19_preokret)C++11
50 / 50
5 ms436 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include<ext/rope> #define mem(a, b) memset(a, (b), sizeof(a)) #define all(c) (c).begin(),(c).end() #define sz(a) ((int)(a.size())) #define ll long long #define linf (ll)1e18 #define inf (int)1e9 #define minf 0x3F3F3F3F #define pb push_back #define fs first #define sc second #define mp make_pair #define mod 1000000007 #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MAX 200005 #define watch(x) cerr<<#x<<" = "<<(x)<<endl; using namespace std; typedef pair<int,int> pii; typedef pair<ll,ll> pll; ll n, city, enemy, big, ti, g, lastc, laste; int main() { IO; cin >> n; ti++; for(int i=1;i<=n;i++) { cin >> g; if(g==1) lastc = i; if(g==2) laste = i; if(g==1) city++; else enemy++; if(city==enemy) ti++; if(city>enemy) { big = max(big, i-laste); } if(city<enemy) { big = max(big, i-lastc); } } cout << city << " " << enemy << "\n"; cout << ti << "\n" << big; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...