# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
198273 | alrad | Preokret (COCI19_preokret) | C++17 | 10 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base :: sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
int n;
cin >> n;
int a = 0 , b = 0;
int ties = 1;
vector<int> tot;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
tot.push_back(x);
(x == 1 ? a++ : b++);
if (a == b) {
ties++;
}
}
cout << a << " " << b << '\n';
cout << ties << '\n';
a = b = 0;
int turnover = 0;
for (int i = 0; i < n; i++) {
(tot[i] == 1 ? a++ : b++);
int scored_a = 0 , scored_b = 0;
for (int j = i + 1; j < n; j++) {
(tot[j] == 1 ? scored_a++ : scored_b++);
if (j != i + 1 && tot[j] != tot[j - 1]) {
break;
}
if (a < b) {
if (a + scored_a > b + scored_b) {
turnover = max(turnover , scored_a);
}
} else if (b < a) {
if (b + scored_b > a + scored_a) {
turnover = max(turnover , scored_b);
}
}
}
}
cout << turnover << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |