# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
245277 | Ort | Preokret (COCI19_preokret) | C++11 | 5 ms | 436 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>
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |