# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645463 | 2022-09-27T07:43:55 Z | TimDee | Gardening (RMI21_gardening) | C++17 | 23 ms | 972 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 23 ms | 972 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 23 ms | 972 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 23 ms | 972 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 10 ms | 728 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 7 ms | 596 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 23 ms | 972 KB | Output does not contain all values between 1 and k |
2 | Halted | 0 ms | 0 KB | - |