Submission #495886

#TimeUsernameProblemLanguageResultExecution timeMemory
495886kinglineNice sequence (IZhO18_sequence)C++17
15 / 100
8 ms716 KiB
/*#pragma GCC optimize("O3") #pragma GCC target ("avx2") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops")*/ #include <bits/stdc++.h> //#define file(data) freopen(data".in", "r", stdin); freopen(data".out", "w", stdout); #define pb push_back #define all(data) data.begin(), data.end() #define endl '\n' using namespace std; const int N = 2e4 + 5; int t, n, m; main() { //file("pieaters"); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> t; while(t--) { cin >> n >> m; if(max(n, m) % min(n, m) == 0) { if(n > m){ cout << n - 1 << endl; for(int i = 1; i < n; i++) { cout << 1 << " "; } } else { cout << m - 1 << endl; for(int i = 1; i < m; i++) { cout << -1 << " "; } } cout << endl; } else if(min(n, m) == 2 || 1){ cout << max(n, m) << endl; vector < int > v; if(n == 2) { for(int i = 1; i <= m; i++) { if(i % 2) cout << m - 1 << " "; else cout << -m << " "; } } else { for(int i = 1; i <= n; i++) { if(i % 2 == 0) cout << n + 1 << " "; else cout << -n << " "; } } cout << endl; } } }

Compilation message (stderr)

sequence.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main() {
      | ^~~~
#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...