Submission #742311

#TimeUsernameProblemLanguageResultExecution timeMemory
742311beepbeepsheepGardening (RMI21_gardening)C++17
5 / 100
8 ms852 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef tree<long long, null_type, less_equal<>,
        rb_tree_tag, tree_order_statistics_node_update>
        ordered_set;
#define ll long long
#define ii pair<ll,ll>

#ifndef DEBUG
#define cerr if (0) cerr
#define endl '\n'
#endif

const ll inf=1e15;
const ll maxn=1e5+5;
const ll mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
	ll n,m,k;
	cin>>n>>m>>k;
	if (n==2 && m==2 && k==1){
		cout<<"YES"<<endl;
		cout<<"1 1"<<endl;
		cout<<"1 1"<<endl;
		return;
	}
	if (n==4 && m==2 && k==2){
		cout<<"YES"<<endl;
		cout<<"1 1"<<endl;
		cout<<"1 1"<<endl;
		cout<<"2 2"<<endl;
		cout<<"2 2"<<endl;
		return;
	}
	if (n==2 && m==4 && k==2){
		cout<<"YES"<<endl;
		cout<<"1 1 2 2"<<endl;
		cout<<"1 1 2 2"<<endl;
		return;
	}
	if (n==4 && m==4){
		if (k==2){
			cout<<"YES"<<endl;
			cout<<"1 1 1 1"<<endl;
			cout<<"1 2 2 1"<<endl;
			cout<<"1 2 2 1"<<endl;
			cout<<"1 1 1 1"<<endl;
			return;
		}
		if (k==4){
			cout<<"YES"<<endl;
			cout<<"1 1 2 2"<<endl;
			cout<<"1 1 2 2"<<endl;
			cout<<"3 3 4 4"<<endl;
			cout<<"3 3 4 4"<<endl;
			return;
		}
	}
	cout<<"NO"<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll tc;
	cin>>tc;
	while (tc--) solve();
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...