Submission #1118904

#TimeUsernameProblemLanguageResultExecution timeMemory
1118904VanioGardening (RMI21_gardening)C++17
5 / 100
5 ms988 KiB
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("avx2")*/

#define ll int64_t

#include<bits/stdc++.h>
using namespace std;

const ll MAXN=2e5+3;
ll n,m,k;

void solve(){
    cin>>n>>m>>k;

    if(k==1){
        if(n==2 && m==2) cout<<"YES\n1 1\n1 1\n";
        else cout<<"NO\n";
    }

    else if(k==2){
        if(n==2 && m==4){
            cout<<"YES\n";
            cout<<"1 1 2 2\n";
            cout<<"1 1 2 2\n";
        }
        else if(m==2 && n==4){
            cout<<"YES\n";
            cout<<"1 1\n";
            cout<<"1 1\n";
            cout<<"2 2\n";
            cout<<"2 2\n";
        }
        else if(n==4 && m==4){
            cout<<"YES\n";
            cout<<"1 1 1 1\n";
            cout<<"1 2 2 1\n";
            cout<<"1 2 2 1\n";
            cout<<"1 1 1 1\n";
        }
        else cout<<"NO\n";
    }

    else if(k==3){
        cout<<"NO\n";
    }

    else if(k==4){
        if(n==4 && m==4){
            cout<<"YES\n";
            cout<<"1 1 2 2\n";
            cout<<"1 1 2 2\n";
            cout<<"3 3 4 4\n";
            cout<<"3 3 4 4\n";
        }
        else cout<<"NO\n";
    }

    else cout<<"NO\n";
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    ll t=1;
    cin>>t;
    while(t--) solve();

    return 0;
}
/*
4
2 2 2
2 2 1
4 4 4
4 4 2
*/
#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...