Submission #439794

#TimeUsernameProblemLanguageResultExecution timeMemory
439794rainboyJetpack (COCI16_jetpack)C11
80 / 80
18 ms3268 KiB
#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)

jetpack.c: In function 'main':
jetpack.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
jetpack.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%s", cc[h]);
      |   ^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...