# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1114061 | 2024-11-18T07:19:45 Z | vjudge1 | Nice sequence (IZhO18_sequence) | C++17 | 1 ms | 504 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::cout << "0\n"; } 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 1, pans = 0 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 1, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 504 KB | Jury has the better answer : jans = 5, pans = 4 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Ok |
2 | Correct | 1 ms | 336 KB | Ok |
3 | Incorrect | 1 ms | 336 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |