# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439794 | rainboy | Jetpack (COCI16_jetpack) | C11 | 18 ms | 3268 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 100000
#define H 10
int main() {
static char cc[H][N + 1], can[H][N];
int n, h, i, k, l;
scanf("%d", &n);
for (h = 0; h < H; h++)
scanf("%s", cc[h]);
for (h = 0; h < H; h++)
can[h][n - 1] = cc[h][n - 1] == '.';
for (i = n - 2; i >= 0; i--)
for (h = 0; h < H; h++)
if (cc[h][i] == '.' && (can[h == 0 ? 0 : h - 1][i + 1] || can[h == 9 ? 9 : h + 1][i + 1]))
can[h][i] = 1;
l = 0;
for (h = 9, i = 0, k = 0; i < n; i++)
if (i + 1 < n && can[h == 0 ? 0 : h - 1][i + 1])
h = h == 0 ? 0 : h - 1, k++;
else {
h = h == 9 ? 9 : h + 1;
if (k > 0)
l++, k = 0;
}
printf("%d\n", l);
for (h = 9, i = 0, k = 0; i < n; i++)
if (i + 1 < n && can[h == 0 ? 0 : h - 1][i + 1])
h = h == 0 ? 0 : h - 1, k++;
else {
h = h == 9 ? 9 : h + 1;
if (k > 0)
printf("%d %d\n", i - k, k), k = 0;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |