Submission #543174

#TimeUsernameProblemLanguageResultExecution timeMemory
543174rainboyDijamant (COCI22_dijamant)C11
70 / 70
122 ms35572 KiB
#include <stdio.h> #define N 2000 #define M 2000 int main() { static char cc[N][M + 1]; static int ll[N][M], rr[N][M]; int n, m, i, i_, i1, j, cnt, good; 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++) ll[i][j] = cc[i][j] == '#' ? j : (j == 0 ? -1 : ll[i][j - 1]); for (j = m - 1; j >= 0; j--) rr[i][j] = cc[i][j] == '#' ? j : (j + 1 == m ? m : rr[i][j + 1]); } cnt = 0; for (j = 0; j < m; j++) for (i_ = -1, i = 0; i < n; i++) if (cc[i][j] == '#') { if (i_ == -1 || (i - i_) % 2 != 0 || j - (i - i_) / 2 < 0 || j + (i - i_) / 2 >= m) good = 0; else { good = 1; for (i1 = i_; i1 * 2 <= i + i_; i1++) if (ll[i1][j] != j - (i1 - i_) || rr[i1][j] != j + (i1 - i_) || ll[i + i_ - i1][j] != j - (i1 - i_) || rr[i + i_ - i1][j] != j + (i1 - i_)) { good = 0; break; } } if (good) cnt++; i_ = i; } printf("%d\n", cnt); return 0; }

Compilation message (stderr)

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