# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
794751 | rainboy | Gardening (RMI21_gardening) | C11 | 14 ms | 804 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>
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |