Submission #1109227

#TimeUsernameProblemLanguageResultExecution timeMemory
1109227MuhammetNice sequence (IZhO18_sequence)C++17
15 / 100
6 ms848 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int n, m; cin >> n >> m; if(min(n,m) == 2){ int x = max(n,m)-(max(n,m) % 2 == 0); cout << x << "\n"; if(n < m){ for(int i = 1; i <= x; i++){ if(i % 2 == 1) cout << x << ' '; else cout << -(x+1) << ' '; } } else { for(int i = 1; i <= x; i++){ if(i % 2 == 1) cout << -(x) << ' '; else cout << x+1 << ' '; } } } else { if(n < m){ cout << m-1 << '\n'; for(int i = 1; i < m; i++){ cout << -1 << ' '; } } else { cout << n-1 << "\n"; for(int i = 1; i < n; i++){ cout << 1 << ' '; } } } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...