# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477016 | rainboy | Preokret (COCI18_preokret) | C11 | 1 ms | 292 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 2879
#define M 2879
#define X 1440
int main() {
static int xx[N], yy[M];
int n, m, i, j, c, cnt1, cnt2;
scanf("%d", &n);
cnt1 = 0;
for (i = 0; i < n; i++) {
scanf("%d", &xx[i]);
if (xx[i] <= X)
cnt1++;
}
scanf("%d", &m);
for (j = 0; j < m; j++) {
scanf("%d", &yy[j]);
if (yy[j] <= X)
cnt1++;
}
i = 0, j = 0, c = 0, cnt2 = 0;
while (i < n || j < m) {
if (j == m || i < n && xx[i] < yy[j])
i++;
else
j++;
if (i < j && c != -1)
c = -1, cnt2++;
if (i > j && c != 1)
c = 1, cnt2++;
}
cnt2--;
printf("%d\n", cnt1);
printf("%d\n", cnt2);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |