# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685171 | Farhan_HY | Preokret (COCI19_preokret) | C++14 | 1 ms | 328 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>
#define int long long
#define F first
#define S second
#define T int t; cin >> t; while(t--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 205;
const int M = 1e3 + 3;
const int inf = 1e18;
const int mod = 1e9 + 7;
int n, team1, team2;
main() {
IOS
cin >> n;
int cnt1 = 0, cnt2 = 0, mx = 0, tie = 1;
for(int i = 1; i <= n; i++) {
int x;
cin >> x;
if (x == 1) {
cnt1++;
cnt2 = 0;
team1++;
if (team1 > team2 && team1 - cnt1 < team2)
mx = max(mx, cnt1);
}
else {
cnt2++;
cnt1 = 0;
team2++;
if (team2 > team1 && team2 - cnt2 < team1)
mx = max(mx, cnt2);
}
tie += team1 == team2;
}
cout << team1 << ' ' << team2 << '\n' << tie << '\n' << mx;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |