답안 #742333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742333 2023-05-16T06:22:56 Z hmm789 Gardening (RMI21_gardening) C++14
0 / 100
13 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t;
	cin >> t;
	while(t--) {
		int n, m, k;
		cin >> n >> m >> k;
		if(n % 2 == 1 || m % 2 == 1) {
			cout << "NO\n";
			continue;
		}
		if(n == 2) {
			if(k == m/2) {
				cout << "YES\n";
				for(int i = 0; i < m; i++) cout << i/2+1 << " ";
				cout << '\n';
				for(int i = 0; i < m; i++) cout << i/2+1 << " ";
				cout << '\n';
			} else cout << "NO\n";
		} else {
			if(m == 2 || k < m/2 || k == m-1) cout << "NO\n";
			else {
				cout << "YES\n";
				vector<int> v;
				int cur = m-k;
				if(cur % 2 == 1) {
					v.push_back(6);
					cur -= 3;
				}
				for(int i = 0; i < cur/2; i++) {
					v.push_back(4);
				}
				cur = 0;
				for(int i : v) cur += i;
				for(int i = 0; i < m-cur; i+=2) v.push_back(2);
				int cols = 1;
				vector<int> first, sec, thi;
				for(int i : v) {
					for(int j = 0; j < i; j++) {
						cout << cols << " ";
						first.push_back(cols);
					}
					cols++;
				}
				cout << '\n';
				cur = 0;
				for(int i : v) {
					cout << first[cur] << " ";
					sec.push_back(first[cur]);
					cur++;
					if(i == 4) {
						for(int j = 0; j < i-2; j++) {
							cout << cols << " ";
							sec.push_back(cols);
							cur++;
						}
						cols++;
					} 
					if(i == 6) {
						for(int j = 0; j < 2; j++) {
							cout << cols << " ";
							sec.push_back(cols);
							cur++;
						}
						cols++;
						for(int j = 0; j < 2; j++) {
							cout << cols << " ";
							sec.push_back(cols);
							cur++;
						}
						cols++;
					}
					cout << first[cur] << " ";
					sec.push_back(first[cur]);
					cur++;
				}
				cout << '\n';
				cur = 0;
				for(int i : v) {
					if(i > 2) {
						for(int j = 0; j < i; j++) {
							cout << sec[cur] << " ";
							cur++;
							thi.push_back(sec[cur]);
						}
					} else {
						for(int j = 0; j < i; j++) {
							cout << cols << " ";
							cur++;
							thi.push_back(cols);
						}
						cols++;
					}
				}
				cout << '\n';
				cur = 0;
				for(int i : v) {
					if(i > 2) {
						for(int j = 0; j < i; j++) {
							cout << first[cur] << " ";
							cur++;
						}
					} else {
						for(int j = 0; j < i; j++) {
							cout << thi[cur] << " ";
							cur++;
						}
					}
				}
				cout << '\n';
			}
		}
	}
}

# 결과 실행 시간 메모리 Grader output
1 Failed 13 ms 596 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 13 ms 596 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 13 ms 596 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Expected integer, but "YES" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 2 ms 340 KB Incorrect output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 13 ms 596 KB Incorrect output
2 Halted 0 ms 0 KB -