# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
245277 | Ort | Preokret (COCI19_preokret) | C++11 | 5 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |