Submission #335266

#TimeUsernameProblemLanguageResultExecution timeMemory
335266limabeansNice sequence (IZhO18_sequence)C++17
0 / 100
1 ms492 KiB
#include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int N = 1e6; void solve(ll n, ll m) { assert(min(n,m)==2); if (n==2) { if (m%2==0) { cout<<"0\n"; return; } cout<<m<<"\n"; vector<ll> w(m,N); for (int i=1; i<m; i+=2) { w[i]=-N-1; } cout<<m<<"\n"; for (ll x: w) cout<<x<<" "; cout<<"\n"; assert(accumulate(w.begin(),w.end(),0ll)>0); return; } if (m==2) { if (n%2==0) { cout<<"0\n"; return; } cout<<n<<"\n"; vector<ll> w(n,N); for (int i=0; i<n; i+=2) { w[i]=-N+1; } for (ll x: w) cout<<x<<" "; cout<<"\n"; assert(accumulate(w.begin(),w.end(),0ll)<0); return; } assert(false); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin>>t; while (t--) { ll n,m; cin>>n>>m; solve(n,m); } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...