Submission #645478

#TimeUsernameProblemLanguageResultExecution timeMemory
645478TimDeeGardening (RMI21_gardening)C++17
11 / 100
25 ms880 KiB
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i=0;i<n;++i) #define prn {cout<<"NO\n";return;} #define pry cout<<"YES\n"; void solve() { int n,m,k; cin>>n>>m>>k; int s=n*m; if (k>(s/4)) prn; if (n&1 || m&1) prn; vector<vector<int>> a(n,vector<int>(m,-1)); if (n==2) { if (k!=m/2) prn; pry; forn(k,2) { for (int i=0; i<m; i+=2) { cout<<(i/2)+1<<' '<<(i/2)+1<<' '; } cout<<'\n'; } return; } if (n==4) { if (k<(m/2) || k>m) prn; if (k==m-1) prn; pry; int y=m-k; assert(y!=1); if (y) { a[1][0]=a[2][0]=1; a[1][2*y-1]=a[2][2*y-1]=1; } int cnt=(y>0)+1; for (int i=0; i<2*y; ++i) { a[0][i]=a[3][i]=1; } for (int j=1; j<2*y-1; j+=2) { a[1][j]=a[1][j+1]=a[2][j]=a[2][j+1]=cnt++; } for (int i=2*y; i<m; i+=2) { a[0][i]=a[0][i+1]=a[1][i]=a[1][i+1]=cnt++; a[2][i]=a[2][i+1]=a[3][i]=a[3][i+1]=cnt++; } for (auto x:a) { for (auto y:x) cout<<y<<' '; cout<<'\n'; } return; } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin>>t; while (t--) 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...