Submission #794751

#TimeUsernameProblemLanguageResultExecution timeMemory
794751rainboyGardening (RMI21_gardening)C11
11 / 100
14 ms804 KiB
#include <stdio.h> int max(int a, int b) { return a > b ? a : b; } int main() { int t; scanf("%d", &t); while (t--) { int n, m, k, i, j; scanf("%d%d%d", &n, &m, &k); if (n % 2 != 0 || m % 2 != 0 || k > n * m / 4 || k < max(n, m) / 2) { printf("NO\n"); continue; } if (k == n * m / 4) { printf("YES\n"); for (i = 0; i < n; i++) { for (j = 0; j < m; j++) printf("%d ", i / 2 * (m / 2) + j / 2 + 1); printf("\n"); } continue; } if (n == 2) printf("NO\n"); else if (n == 4) { if (k == m - 1 || k < m / 2) printf("NO\n"); else { printf("YES\n"); for (i = 0; i < n; i++) { for (j = 0; j < m; j++) if (j < (m - k) * 2) { if (j == 0 || j == (m - k) * 2 - 1 || i == 0 || i == 3) printf("1 "); else printf("%d ", (j - 1) / 2 + 2); } else printf("%d ", i / 2 * (k - m / 2) + j / 2 + 1); printf("\n"); } } } } return 0; }

Compilation message (stderr)

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