# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
481170 | rainboy | Preokret (COCI19_preokret) | C11 | 1 ms | 276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 250
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N];
int n, i, j, a, b, t, l;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
a = 0, b = 0, t = 1, l = 0;
for (i = 0; i < n; i = j) {
int c;
j = i, c = a - b;
while (j < n && aa[j] == aa[i]) {
if (aa[j] == 1)
a++;
else
b++;
if (a == b)
t++;
j++;
}
if (c > 0 && a - b < 0 || c < 0 && a - b > 0)
l = max(l, j - i);
}
printf("%d %d\n", a, b);
printf("%d\n", t);
printf("%d\n", l);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |