Submission #341930

#TimeUsernameProblemLanguageResultExecution timeMemory
341930_aniNice sequence (IZhO18_sequence)C++17
15 / 100
13 ms876 KiB
#include <iostream> #include <algorithm> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (max(n, m) % min(n, m) == 0) { cout << max(n, m) - 1 << '\n'; if (n < m) for (int i = 0; i < max(n, m) - 1; i++) cout << -1 << ' '; else for (int i = 0; i < max(n, m) - 1; i++) cout << 1 << ' '; cout << '\n'; } //n - <0 //m - >0 else if (min(n, m) == 2) { int q = max(n, m); cout << q << '\n'; int N = 1'000'000; if(n < m) for (int i = 0; i < q; i++) { if (i % 2)cout << -(N + 1) << ' '; else cout << N << ' '; } else for (int i = 0; i < q; i++) { if (i % 2)cout << N + 1 << ' '; else cout << -N << ' '; } cout << '\n'; } } 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...