Submission #1101635

# Submission time Handle Problem Language Result Execution time Memory
1101635 2024-10-16T12:25:21 Z Ciprian Gardening (RMI21_gardening) C++14
0 / 100
132 ms 896 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 
 
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    for(int i=0; i<t; i++){
        int n,m, k;
        cin>>n>>m>>k;
        if(m%2==1 || n%2==1){
            cout<<"NO"<<endl;
        }else if(n<=4){
            if(n==2){
                if(m/2==k){
                    int cnt=1;
                    cout<<"YES"<<endl;
                    for(int x=0;x<k; x++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                    }cout<<endl;
                    cnt=1;
                    for(int x=0;x<k; x++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                    }cout<<endl;
                }else{
                    cout<<"NO"<<endl;
                }
            }else{
                if((m-2)/2==k-1 && k>1){
                    cout<<"YES"<<endl;
                    for(int j=0; j<m; j++){
                        cout<<1<<" ";
                        
                    }cout<<endl;
                    cout<<1<<" ";
                    int cnt=2;
                    for(int j=1;j<k; j++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                        
                    }cout<<1<<endl;
                    cout<<1<<" ";
                    cnt=2;
                    for(int j=1;j<k; j++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                        
                    }cout<<1<<endl;
                    for(int j=0; j<m; j++){
                        cout<<1<<" ";
                        
                    }cout<<endl;
                }else if(m==k){
                    cout<<"YES"<<endl;
                    int cnt=1;
                    for(int j=0; j<k/2; j++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                    }cnt=1;
                    cout<<endl;
                    for(int j=0; j<k/2; j++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                    }int x=cnt;
                    cout<<endl;
                    for(int j=0; j<k/2; j++){
                        cout<<cnt<<" "<<cnt<<" ";
                        cnt++;
                    }cout<<endl;
                    for(int j=0; j<k/2; j++){
                        cout<<x<<" "<<x<<" ";
                        x++;
                    }cout<<endl;
            
                }else if((m+2)/2==k){
                    int cnt=1, tr=1;
                    vector<int> v(m+4);
                    for(int j=1; j<=(m-2)/4; j++){
                        for(int q=1; q<=4; q++){
                            cout<<cnt<<" ";
                            v[tr]=cnt;
                            tr++;
                        }
                        cnt++;
                    }int t=1;
                    int x=cnt;
                    cout<<k-1<<" "<<k-1<<endl;
                    for(int j=1; j<=(m-2)/4; j++){
                        cout<<v[t]<<" "<<cnt<<" "<<cnt<<" "<<v[t]<<" ";
                        t+=4;
                        cnt++;
                    } t=1;
                
                    cout<<k-1<<" "<<k-1<<endl;
                    for(int j=1; j<=(m-2)/4; j++){
                        cout<<v[t]<<" "<<x<<" "<<x<<" "<<v[t]<<" ";
                        t+=4;
                        x++;
                    }cout<<k<<" "<<k<<endl;
                    for(int j=1; j<m-1; j++){
                        cout<<v[j]<<" ";
                    }cout<<k<<" "<<k<<endl;
                }else{
                    cout<<"NO"<<endl;
                }
            }
        }
    }
 
    return 0;
}

# Verdict Execution time Memory Grader output
1 Failed 132 ms 896 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 132 ms 896 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 132 ms 896 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 336 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 336 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 132 ms 896 KB Incorrect output
2 Halted 0 ms 0 KB -