# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
991705 | 2024-06-02T20:14:13 Z | Abito | Gardening (RMI21_gardening) | C++17 | 11 ms | 856 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 856 KB | Correct! Azusa and Laika like the garden :) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 856 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 6 ms | 604 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 6 ms | 652 KB | Correct! Azusa and Laika like the garden :) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 856 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 6 ms | 604 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 6 ms | 652 KB | Correct! Azusa and Laika like the garden :) |
4 | Failed | 5 ms | 600 KB | Output contains values not between 1 and k |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 1 ms | 348 KB | Incorrect output |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 1 ms | 348 KB | Incorrect output |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 856 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 6 ms | 604 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 6 ms | 652 KB | Correct! Azusa and Laika like the garden :) |
4 | Failed | 5 ms | 600 KB | Output contains values not between 1 and k |
5 | Halted | 0 ms | 0 KB | - |