# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
481170 | rainboy | Preokret (COCI19_preokret) | C11 | 1 ms | 276 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |