답안 #737015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
737015 2023-05-06T13:10:46 Z jk410 Gardening (RMI21_gardening) C++17
11 / 100
13 ms 848 KB
#include <bits/stdc++.h>
using namespace std;
int T;
int N, M, K;
void solve() {
	cin >> N >> M >> K;
	if (N % 2 || M % 2) {
		cout << "NO\n";
		return;
	}
	if (N == 2) {
		if (K != M / 2) {
			cout << "NO\n";
			return;
		}
		cout << "YES\n";
		for (int i = 1; i <= M / 2; i++)
			cout << i << " " << i << " ";
		cout << "\n";
		for (int i = 1; i <= M / 2; i++)
			cout << i << " " << i << " ";
		cout << "\n";
		return;
	}
	if (N == 4) {
		if (K<max(N,M)/2||K>N*M/4||K==N*M/4-1) {
			cout << "NO\n";
			return;
		}
		cout << "YES\n";
		if (M == 2) {
			cout << "1 1\n1 1\n2 2\n2 2\n";
			return;
		}
		vector<vector<int>> a(N + 1);
		for (int i = 1; i <= N; i++) {
			a[i].resize(M + 1);
			for (int j = 1; j <= M; j++)
				a[i][j] = K;
		}
		int x = K - M / 2;
		int tmp = 0;
		for (int i = 1; i <= x; i++)
			a[1][2 * i - 1] = a[1][2 * i] = a[2][2 * i - 1] = a[2][2 * i] = ++tmp;
		for (int i = 1; i <= x; i++)
			a[3][2 * i - 1] = a[3][2 * i] = a[4][2 * i - 1] = a[4][2 * i] = ++tmp;
		for (int i = 1; i < M/2 - x; i++)
			a[2][2 * i + 2 * x] = a[2][2 * i + 2 * x + 1] = a[3][2 * i + 2 * x] = a[3][2 * i + 2 * x + 1] = ++tmp;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= M; j++)
				cout << a[i][j] << " ";
			cout << "\n";
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> T;
	while (T--)
		solve();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 848 KB Correct! Azusa and Laika like the garden :)
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 848 KB Correct! Azusa and Laika like the garden :)
2 Correct 10 ms 584 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 596 KB Correct! Azusa and Laika like the garden :)
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 848 KB Correct! Azusa and Laika like the garden :)
2 Correct 10 ms 584 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 596 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 7 ms 468 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 1 ms 320 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 1 ms 212 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 848 KB Correct! Azusa and Laika like the garden :)
2 Correct 10 ms 584 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 596 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 7 ms 468 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -