Submission #944275

#TimeUsernameProblemLanguageResultExecution timeMemory
944275dilanyanNice sequence (IZhO18_sequence)C++17
15 / 100
10 ms796 KiB
//-------------dilanyan------------\\ #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #include<stdio.h> using namespace std; //------------------KarginDefines--------------------\\ #define ll long long #define pb push_back #define all(u) (u).begin(), (u).end() #define pqueue priority_queue #define upper upper_bound #define lower lower_bound #define umap unordered_map #define uset unordered_set #define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL); #define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout); //-------------------KarginConstants------------------\\ const ll mod = 1000000007; const ll inf = 1e18; //-------------------KarginCode------------------------\\ const int N = 300005; void KarginSolve() { int n, m; cin >> n >> m; if (max(n, m) % min(n, m) == 0) { cout << max(n, m) - 1 << '\n'; for (int i = 1;i < max(n, m);i++) { if (n >= m) cout << 1 << ' '; else cout << -1 << ' '; } cout << '\n'; } else if (min(n, m) == 2) { if (max(n, m) % 2 == 0) { cout << max(n, m) - 1 << '\n'; for (int i = 1;i < max(n, m);i++) { if (n == 2) cout << -1 << ' '; else cout << 1 << '\n'; } cout << '\n'; } else { int c = max(n, m) - 1; int k = c / 2; cout << c + 1 << '\n'; k++; for (int i = 1;i <= c;i += 2) { if (n == 2) cout << k << ' ' << (-k - 1) << ' '; else cout << -k << ' ' << k + 1 << ' '; } if (n == 2) cout << k << '\n'; else cout << -k << '\n'; } } } int main() { //Usaco Kargin; int test = 1; cin >> test; while (test--) { KarginSolve(); } return 0; }

Compilation message (stderr)

sequence.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
sequence.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
sequence.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
sequence.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
#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...