Submission #519252

#TimeUsernameProblemLanguageResultExecution timeMemory
519252KoDPreokret (COCI19_preokret)C++17
50 / 50
1 ms204 KiB
#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 timeMemoryGrader output
Fetching results...