Submission #794751

# Submission time Handle Problem Language Result Execution time Memory
794751 2023-07-26T21:32:10 Z rainboy Gardening (RMI21_gardening) C
11 / 100
14 ms 804 KB
#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

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 time Memory Grader output
1 Correct 14 ms 804 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 14 ms 804 KB Correct! Azusa and Laika like the garden :)
2 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
3 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 14 ms 804 KB Correct! Azusa and Laika like the garden :)
2 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
3 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 5 ms 468 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 288 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 284 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 804 KB Correct! Azusa and Laika like the garden :)
2 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
3 Correct 7 ms 596 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 5 ms 468 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -