# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
206146 | 2020-03-02T12:35:00 Z | luciocf | Preokret (COCI19_preokret) | C++14 | 5 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 255; int a[maxn]; int main(void) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); int q1 = 0, q2 = 0, emp = 0; int turn = 0; for (int i = 1; i <= n; i++) { if (q1 == q2) emp++; if (q1 < q2 && a[i] == 1) { int j; for (j = i; j <= n && a[j] == 1; j++) ; j--; if (q1+j-i+1 > q2) turn = max(turn, j-i+1); } else if (q2 < q1 && a[i] == 2) { int j; for (j = i; j <= n && a[j] == 2; j++) ; j--; if (q2+j-i+1 > q1) turn = max(turn, j-i+1); } if (a[i] == 1) q1++; else q2++; } printf("%d %d\n%d\n%d\n", q1, q2, emp, turn); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 380 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 256 KB | Output is correct |
9 | Partially correct | 5 ms | 376 KB | Output is partially correct |
10 | Correct | 5 ms | 376 KB | Output is correct |