Submission #645478

# Submission time Handle Problem Language Result Execution time Memory
645478 2022-09-27T08:17:19 Z TimDee Gardening (RMI21_gardening) C++17
11 / 100
25 ms 880 KB
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for (int i=0;i<n;++i)
#define prn {cout<<"NO\n";return;}
#define pry cout<<"YES\n";

void solve() {
	int n,m,k; cin>>n>>m>>k;
	int s=n*m;
	if (k>(s/4)) prn;
	if (n&1 || m&1) prn;
	vector<vector<int>> a(n,vector<int>(m,-1));

	if (n==2) {
		if (k!=m/2) prn;
		pry;
		forn(k,2) {
			for (int i=0; i<m; i+=2) {
				cout<<(i/2)+1<<' '<<(i/2)+1<<' ';
			}
			cout<<'\n';
		}
		return;
	}
	if (n==4) {
		if (k<(m/2) || k>m) prn;
		if (k==m-1) prn;
		pry;
		int y=m-k;
		assert(y!=1);
		if (y) {
			a[1][0]=a[2][0]=1;
			a[1][2*y-1]=a[2][2*y-1]=1;
		}
		int cnt=(y>0)+1;
		for (int i=0; i<2*y; ++i) {
			a[0][i]=a[3][i]=1;
		}
		for (int j=1; j<2*y-1; j+=2) {
			a[1][j]=a[1][j+1]=a[2][j]=a[2][j+1]=cnt++;
		}
		for (int i=2*y; i<m; i+=2) {
			a[0][i]=a[0][i+1]=a[1][i]=a[1][i+1]=cnt++;
			a[2][i]=a[2][i+1]=a[3][i]=a[3][i+1]=cnt++;
		}
		for (auto x:a) {
			for (auto y:x) cout<<y<<' '; 
			cout<<'\n';
		}
		return;
	}

}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t; cin>>t;
	while (t--) solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 25 ms 880 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 25 ms 880 KB Correct! Azusa and Laika like the garden :)
2 Correct 14 ms 616 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 560 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 25 ms 880 KB Correct! Azusa and Laika like the garden :)
2 Correct 14 ms 616 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 560 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 -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 340 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 340 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 880 KB Correct! Azusa and Laika like the garden :)
2 Correct 14 ms 616 KB Correct! Azusa and Laika like the garden :)
3 Correct 10 ms 560 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 -