Submission #645463

#TimeUsernameProblemLanguageResultExecution timeMemory
645463TimDeeGardening (RMI21_gardening)C++17
0 / 100
23 ms972 KiB
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i=0;i<n;++i) void solve() { int n,m,k; cin>>n>>m>>k; int s=n*m; if (k>(s/2)) { cout<<"NO\n"; return; } cout<<"YES\n"; if (m==1) { forn(i,k*(n/k)) cout<<(i/(n/k))+1<<'\n'; for (int i=k*(n/k);i<n;++i) cout<<k<<'\n'; return; } int cnt=1; vector<vector<int>> a(n,vector<int>(m,k)); if (m&1) { for (int i=0; i<m && cnt<k; ++i) { if (i&1) { for (int j=m-2; j>=0 && cnt<k; j-=2) { a[i][j]=cnt; a[i][j-1]=cnt; ++cnt; } } else { for (int j=0; j<m && cnt<k; j+=2) { a[i][j]=cnt; a[i][j+1]=cnt; ++cnt; } if (cnt<k) { a[i][m-1]=a[i+1][m-1]=cnt++; } } } } for (auto x:a) { for (auto y:x) cout<<y<<' '; cout<<'\n'; } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin>>t; while (t--) solve(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:41:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   41 |   for (auto y:x) cout<<y<<' '; cout<<'\n';
      |   ^~~
Main.cpp:41:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   41 |   for (auto y:x) cout<<y<<' '; cout<<'\n';
      |                                ^~~~
#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...