# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114064 | 2024-11-18T07:22:03 Z | vjudge1 | Nice sequence (IZhO18_sequence) | C++17 | 1 ms | 512 KB |
#include <bits/stdc++.h> using i64 = long long; #ifdef DEBUG #include "/home/ahmetalp/Desktop/Workplace/debug.h" #else #define debug(...) void(23) #endif void solve() { int N, M; std::cin >> N >> M; bool swapped = false; if (N < M) { swapped = true; std::swap(N, M); } if (N == M) { std::vector<int> p(N - 1); for (int i = 0; i < N - 1; ++i) { p[i] = 1; } std::cout << p.size() << '\n'; for (int i = 0; i < N - 1; ++i) { std::cout << p[i] << " \n"[i == N - 2]; } } else if (N == M + 1) { std::vector<int> p; if (N == 2) { // 2 1 p = {1}; } else if (N == 3) { // 3 2 p = {-3, 4, -2}; } else if (N == 4) { // 4 3 p = {-8, 4, 5, -8}; } else { p.assign(N, 0); p[0] = p.back() = -(N - 3); for (int i = 1; i < N - 1; ++i) { p[i] = +1; } } std::cout << p.size() << '\n'; for (int i = 0; i < p.size(); ++i) { if (swapped) { p[i] *= -1; } std::cout << p[i] << " \n"[i == p.size() - 1]; } } else { std::vector<int> p(N - 1); for (int i = 0; i < N - 1; ++i) { p[i] = 1; } std::cout << p.size() << '\n'; for (int i = 0; i < N - 1; ++i) { if (swapped) { p[i] *= -1; } std::cout << p[i] << " \n"[i == N - 2]; } } return; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int TT = 1; std::cin >> TT; for (int i = 1; i <= TT; ++i) { solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Correct | 1 ms | 336 KB | Ok |
4 | Correct | 1 ms | 336 KB | Ok |
5 | Correct | 1 ms | 336 KB | Ok |
6 | Correct | 1 ms | 336 KB | Ok |
7 | Correct | 1 ms | 336 KB | Ok |
8 | Correct | 1 ms | 336 KB | Ok |
9 | Correct | 1 ms | 504 KB | Ok |
10 | Correct | 1 ms | 336 KB | Ok |
11 | Correct | 1 ms | 504 KB | Ok |
12 | Correct | 1 ms | 336 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 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 | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 512 KB | Jury has the better answer : jans = 5, pans = 4 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 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 | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Correct | 1 ms | 336 KB | Ok |
4 | Correct | 1 ms | 336 KB | Ok |
5 | Correct | 1 ms | 336 KB | Ok |
6 | Correct | 1 ms | 336 KB | Ok |
7 | Correct | 1 ms | 336 KB | Ok |
8 | Correct | 1 ms | 336 KB | Ok |
9 | Correct | 1 ms | 504 KB | Ok |
10 | Correct | 1 ms | 336 KB | Ok |
11 | Correct | 1 ms | 504 KB | Ok |
12 | Correct | 1 ms | 336 KB | Ok |
13 | Correct | 1 ms | 336 KB | Ok |
14 | Correct | 1 ms | 336 KB | Ok |
15 | Incorrect | 1 ms | 512 KB | Jury has the better answer : jans = 5, pans = 4 |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Correct | 1 ms | 336 KB | Ok |
4 | Correct | 1 ms | 336 KB | Ok |
5 | Correct | 1 ms | 336 KB | Ok |
6 | Correct | 1 ms | 336 KB | Ok |
7 | Correct | 1 ms | 336 KB | Ok |
8 | Correct | 1 ms | 336 KB | Ok |
9 | Correct | 1 ms | 504 KB | Ok |
10 | Correct | 1 ms | 336 KB | Ok |
11 | Correct | 1 ms | 504 KB | Ok |
12 | Correct | 1 ms | 336 KB | Ok |
13 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 5, pans = 4 |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Correct | 1 ms | 336 KB | Ok |
4 | Correct | 1 ms | 336 KB | Ok |
5 | Correct | 1 ms | 336 KB | Ok |
6 | Correct | 1 ms | 336 KB | Ok |
7 | Correct | 1 ms | 336 KB | Ok |
8 | Correct | 1 ms | 336 KB | Ok |
9 | Correct | 1 ms | 504 KB | Ok |
10 | Correct | 1 ms | 336 KB | Ok |
11 | Correct | 1 ms | 504 KB | Ok |
12 | Correct | 1 ms | 336 KB | Ok |
13 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 5, pans = 4 |
14 | Halted | 0 ms | 0 KB | - |