# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
760568 | 2023-06-17T20:16:53 Z | NK_ | Nice sequence (IZhO18_sequence) | C++17 | 6 ms | 980 KB |
// Success consists of going from failure to failure without loss of enthusiasm #include <bits/stdc++.h> using namespace std; #define nl '\n' #define pb push_back using ll = long long; template<class T> using V = vector<T>; const int MAX = 1e9; void solve() { int N, M; cin >> N >> M; bool SWAP = 0; if (N < M) { swap(N, M); SWAP = 1; } // WLOG N > M V<int> A; if (N % M == 0) { int ans = N - 1; A = V<int>(ans); for(auto& x : A) x = 1; } else { int ans = N; A = V<int>(ans); int X = -(MAX - 1) / (M - 1); int REM = (MAX - 1) % (M - 1); // cout << REM << nl; // cout << X << nl; for(int i = 0; i < ans; i++) { if (i % M == M - 1) A[i] = MAX; else { // cout << i % M << " " << REM << endl; A[i] = ((i % M) < REM ? X - 1 : X); } } } // cout << SWAP << nl; if (SWAP) for(auto& x : A) x = -x; cout << size(A) << nl; for(auto& x : A) cout << x << " "; cout << nl; ll SUM = accumulate(begin(A), end(A), 0LL); // cout << SUM << nl; } int main() { cin.tie(0)->sync_with_stdio(0); int T; cin >> T; while(T--) { solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 1 ms | 212 KB | Ok |
5 | Correct | 1 ms | 320 KB | Ok |
6 | Correct | 1 ms | 212 KB | Ok |
7 | Correct | 0 ms | 316 KB | Ok |
8 | Correct | 1 ms | 212 KB | Ok |
9 | Correct | 1 ms | 212 KB | Ok |
10 | Correct | 1 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 324 KB | Ok |
4 | Correct | 1 ms | 320 KB | Ok |
5 | Correct | 1 ms | 316 KB | Ok |
6 | Correct | 2 ms | 340 KB | Ok |
7 | Correct | 5 ms | 852 KB | Ok |
8 | Correct | 3 ms | 580 KB | Ok |
9 | Correct | 6 ms | 980 KB | Ok |
10 | Correct | 4 ms | 724 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 316 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 9, pans = 8 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 1 ms | 212 KB | Ok |
5 | Correct | 1 ms | 320 KB | Ok |
6 | Correct | 1 ms | 212 KB | Ok |
7 | Correct | 0 ms | 316 KB | Ok |
8 | Correct | 1 ms | 212 KB | Ok |
9 | Correct | 1 ms | 212 KB | Ok |
10 | Correct | 1 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Correct | 1 ms | 316 KB | Ok |
14 | Correct | 1 ms | 212 KB | Ok |
15 | Correct | 1 ms | 212 KB | Ok |
16 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 9, pans = 8 |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 1 ms | 212 KB | Ok |
5 | Correct | 1 ms | 320 KB | Ok |
6 | Correct | 1 ms | 212 KB | Ok |
7 | Correct | 0 ms | 316 KB | Ok |
8 | Correct | 1 ms | 212 KB | Ok |
9 | Correct | 1 ms | 212 KB | Ok |
10 | Correct | 1 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Correct | 1 ms | 320 KB | Ok |
14 | Correct | 1 ms | 212 KB | Ok |
15 | Correct | 1 ms | 324 KB | Ok |
16 | Correct | 1 ms | 320 KB | Ok |
17 | Correct | 1 ms | 316 KB | Ok |
18 | Correct | 2 ms | 340 KB | Ok |
19 | Correct | 5 ms | 852 KB | Ok |
20 | Correct | 3 ms | 580 KB | Ok |
21 | Correct | 6 ms | 980 KB | Ok |
22 | Correct | 4 ms | 724 KB | Ok |
23 | Correct | 1 ms | 316 KB | Ok |
24 | Correct | 1 ms | 212 KB | Ok |
25 | Correct | 1 ms | 212 KB | Ok |
26 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 9, pans = 8 |
27 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Ok |
2 | Correct | 1 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 1 ms | 212 KB | Ok |
5 | Correct | 1 ms | 320 KB | Ok |
6 | Correct | 1 ms | 212 KB | Ok |
7 | Correct | 0 ms | 316 KB | Ok |
8 | Correct | 1 ms | 212 KB | Ok |
9 | Correct | 1 ms | 212 KB | Ok |
10 | Correct | 1 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Correct | 1 ms | 320 KB | Ok |
14 | Correct | 1 ms | 212 KB | Ok |
15 | Correct | 1 ms | 324 KB | Ok |
16 | Correct | 1 ms | 320 KB | Ok |
17 | Correct | 1 ms | 316 KB | Ok |
18 | Correct | 2 ms | 340 KB | Ok |
19 | Correct | 5 ms | 852 KB | Ok |
20 | Correct | 3 ms | 580 KB | Ok |
21 | Correct | 6 ms | 980 KB | Ok |
22 | Correct | 4 ms | 724 KB | Ok |
23 | Correct | 1 ms | 316 KB | Ok |
24 | Correct | 1 ms | 212 KB | Ok |
25 | Correct | 1 ms | 212 KB | Ok |
26 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 9, pans = 8 |
27 | Halted | 0 ms | 0 KB | - |