Submission #482400

#TimeUsernameProblemLanguageResultExecution timeMemory
482400rainboyPatkice (COCI20_patkice)C11
50 / 50
1 ms280 KiB
#include <stdio.h> #define N 100 #define M 100 #define INF 0x3f3f3f3f int di[] = { 0, -1, 1, 0 }; int dj[] = { 1, 0, 0, -1 }; char dir[] = "ENSW"; int main() { static char cc[N][M + 1]; int n, m, h, i, j; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) scanf("%s", cc[i]); for (i = 0; i < n; i++) for (j = 0; j < m; j++) if (cc[i][j] == 'o') { int h_ = -1, d_ = INF; for (h = 0; h < 4; h++) { int i_ = i + di[h], j_ = j + dj[h], d = 0; while (cc[i_][j_] != '.' && cc[i_][j_] != 'o' && cc[i_][j_] != 'x') { if (cc[i_][j_] == '>') j_++; else if (cc[i_][j_] == '^') i_--; else if (cc[i_][j_] == 'v') i_++; else j_--; d++; } if (cc[i_][j_] == 'x' && d_ > d) h_ = h, d_ = d; } if (h_ == -1) printf(":(\n"); else { printf(":)\n"); printf("%c\n", dir[h_]); } return 0; } return 0; }

Compilation message (stderr)

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