Submission #991683

#TimeUsernameProblemLanguageResultExecution timeMemory
991683De3b0oGardening (RMI21_gardening)C++17
11 / 100
45 ms800 KiB
#include <bits/stdc++.h> #define ll long long #define no cout << "NO\n" #define yes cout << "YES\n" #define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define lin cout << "\n"; using namespace std; int main() { ll t; cin >> t; while(t--) { ll n , m , k; cin >> n >> m >> k; if(n%2||m%2) { no; continue; } if(n==2) { if(k==m/2) { yes; for(int i = 0 ; n>i ; i++) { for(int j = 0 ; m>j ; j++) { cout << j/2 +1 << " "; } cout << "\n"; } } else no; } else if(n==4) { if(k==m) { yes; for(int i = 0 ; 2>i ; i++) { for(int j = 0 ; m>j ; j++) { cout << j/2 +1 << " "; } cout << "\n"; } for(int i = 0 ; 2>i ; i++) { for(int j = 0 ; m>j ; j++) { cout << j/2 +1 +m/2 << " "; } cout << "\n"; } continue; } for(int idx = 0 ; m>idx ; idx+=2) { if(idx==m-2) { no; break; } if(k==idx+1+(m-idx-2)/2) { yes; for(int i = 0 ; n>i ; i++) { for(int j = 0 ; m>j ; j++) { if(j<idx) { cout << j/2+1+(i/2)*(idx/2) << " "; } else if(i==0||i==3||j==idx||j==m-1) { cout << idx+1 << " "; } else { cout << (j-idx-1)/2+idx+2 << " "; } } lin } break; } } } else if(n==6) { } else no; } }
#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...