답안 #519249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519249 2022-01-26T06:06:35 Z KoD Preokret (COCI19_preokret) C++17
44 / 50
1 ms 292 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[i][k ^ 1] == score[j][k ^ 1]) {
                    turnover = std::max(turnover, j - i);
                }
            }
        }
    }
    std::cout << turnover << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 268 KB Output is correct
2 Correct 0 ms 272 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Partially correct 1 ms 204 KB Output is partially correct
8 Correct 1 ms 204 KB Output is correct
9 Partially correct 1 ms 204 KB Output is partially correct
10 Correct 1 ms 292 KB Output is correct