# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
519249 | KoD | Preokret (COCI19_preokret) | C++17 | 1 ms | 292 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>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
int N;
std::cin >> N;
vector<array<int, 2>> score(N + 1);
for (int i = 0; i < N; ++i) {
score[i + 1] = score[i];
int x;
std::cin >> x;
score[i + 1][x - 1] += 1;
}
std::cout << score[N][0] << ' ' << score[N][1] << '\n';
int tie = 0;
for (int i = 0; i <= N; ++i) {
if (score[i][0] == score[i][1]) {
tie += 1;
}
}
std::cout << tie << '\n';
int turnover = 0;
for (int i = 0; i <= N; ++i) {
for (int j = i + 1; j <= N; ++j) {
for (int k = 0; k < 2; ++k) {
if (score[i][k] < score[i][k ^ 1] and score[i][k ^ 1] == score[j][k ^ 1]) {
turnover = std::max(turnover, j - i);
}
}
}
}
std::cout << turnover << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |