# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
519252 |
2022-01-26T06:09:37 Z |
KoD |
Preokret (COCI19_preokret) |
C++17 |
|
1 ms |
204 KB |
#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[j][k] > score[j][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 |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |