Submission #991705

#TimeUsernameProblemLanguageResultExecution timeMemory
991705AbitoGardening (RMI21_gardening)C++17
11 / 100
11 ms856 KiB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t;cin>>t;
    while (t--){
        int n,m,k;
        cin>>n>>m>>k;
        if ((n&1)||(m&1)){
            cout<<"NO"<<endl;
            continue;
        }
        if (n==2){
            if (k!=m/2){
                cout<<"NO"<<endl;
                continue;
            }cout<<"YES"<<endl;
            for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
            for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
            continue;
        }
        int idx=-1;
        for (int i=0;i<=m/2;i++){
            if (i+m/2==k) idx=i;
        }
        if (-1==idx || idx==m/2-1){
            cout<<"NO"<<endl;
            continue;
        }//cout<<idx<<endl;
        cout<<"YES"<<endl;
        int c=1,a[n+5][m+5]={0};
        for (int i=1;i<=2*idx;i+=2){
            a[1][i]=a[2][i]=a[1][i+1]=a[2][i+1]=c;
            c++;
            a[3][i]=a[4][i]=a[3][i+1]=a[4][i+1]=c;
            c++;
        }
        if (2*idx==m){
            for (int i=1;i<=n;i++){
                for (int j=1;j<=m;j++) cout<<a[i][j]<<' ';
                cout<<endl;
            }
            continue;
        }
        for (int j=1;j<=4;j++) a[j][2*idx+1]=a[j][m]=c;
        c++;
        for (int i=2*idx+2;i<m;i+=2){
            a[1][i]=a[4][i]=a[1][i+1]=a[4][i+1]=a[1][m];
            a[2][i]=a[3][i]=a[2][i+1]=a[3][i+1]=c;
            c++;
        }
        for (int i=1;i<=n;i++){
            for (int j=1;j<=m;j++) cout<<a[i][j]<<' ';
            cout<<endl;
        }
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:30:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |             for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
      |             ^~~
Main.cpp:30:59: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |             for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
      |                                                           ^~~~
Main.cpp:31:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |             for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
      |             ^~~
Main.cpp:31:59: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |             for (int i=1;i<=m/2;i++) cout<<i<<' '<<i<<' ';cout<<endl;
      |                                                           ^~~~
#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...