Submission #742433

#TimeUsernameProblemLanguageResultExecution timeMemory
742433beepbeepsheepGardening (RMI21_gardening)C++17
0 / 100
13 ms596 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define ii pair<ll,ll> #ifndef DEBUG #define cerr if (0) cerr #define endl '\n' #endif const ll inf=1e15; const ll maxn=1e5+5; const ll mod=1e9+7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void solve(){ ll n,m,k; cin>>n>>m>>k; if (n&1 || m&1 || k&1){ cout<<"NO"<<endl; return; } if (n==2){ if (m!=2*k){ cout<<"NO"<<endl; return; } cout<<"YES"<<endl; for (int i=1;i<=k;i++){ cout<<i<<' '<<i<<' '; } cout<<endl; for (int i=1;i<=k;i++){ cout<<i<<' '<<i<<' '; } cout<<endl; return; } if (n==4){ m/=2; ll x=k-m; ll y=m-x; cout<<"YES"<<endl; for (int i=1;i<=2*y;i++){ cout<<1<<' '; } for (int i=1;i<=x;i++) cout<<y+2*i-1<<' '<<y+2*i-1<<' '; cout<<endl; if (y) cout<<1<<' '; for (int i=1;i<=2*y-2;i++){ cout<<(i-1)/2+2<<' '; } if (y) cout<<1<<' '; for (int i=1;i<=x;i++) cout<<y+2*i-1<<' '<<y+2*i-1<<' '; cout<<endl; if (y) cout<<1<<' '; for (int i=1;i<=2*y-2;i++){ cout<<(i-1)/2+2<<' '; } if (y) cout<<1<<' '; for (int i=1;i<=x;i++) cout<<y+2*i<<' '<<y+2*i<<' '; cout<<endl; for (int i=1;i<=2*y;i++){ cout<<1<<' '; } for (int i=1;i<=x;i++) cout<<y+2*i<<' '<<y+2*i<<' '; cout<<endl; cerr<<x<<' '<<y<<endl; } } // n=4, 11111111 // 12233441 // 12233441 // 11111111 // 4 by m -> m/2 // 11333333 // 11344553 // 22344553 // 22333333 // m/=2 // 2x+y=k // x+y=m int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll tc; cin>>tc; while (tc--) 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...