#include <bits/stdc++.h>
using i64 = long long;
#ifdef DEBUG
#include "/home/ahmetalp/Desktop/Workplace/debug.h"
#else
#define debug(...) void(23)
#endif
constexpr int INF = int(1E8);
void print(bool s, std::vector<int> x) {
int n = int(x.size());
std::cout << n << '\n';
for (int i = 0; i < n; ++i) {
std::cout << (s ? -1 : +1) * x[i] << " \n"[i == n - 1];
}
}
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;
}
print(false, p);
} else {
int len = ((N + M - 1) / M) * M - 1;
std::vector<int> p(len);
p[0] = -INF;
for (int i = 1; i < M - 1; ++i) {
p[i] = -1;
}
p[M - 1] = INF + M - 1;
for (int i = M; i < len; ++i) {
p[i] = p[i % M];
}
print(swapped, p);
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Ok |
5 |
Correct |
1 ms |
564 KB |
Ok |
6 |
Correct |
1 ms |
504 KB |
Ok |
7 |
Correct |
1 ms |
336 KB |
Ok |
8 |
Correct |
1 ms |
420 KB |
Ok |
9 |
Correct |
1 ms |
504 KB |
Ok |
10 |
Correct |
1 ms |
336 KB |
Ok |
11 |
Correct |
1 ms |
336 KB |
Ok |
12 |
Correct |
1 ms |
336 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
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 |
460 KB |
Ok |
6 |
Correct |
2 ms |
592 KB |
Ok |
7 |
Correct |
7 ms |
1528 KB |
Ok |
8 |
Correct |
5 ms |
848 KB |
Ok |
9 |
Correct |
8 ms |
1360 KB |
Ok |
10 |
Correct |
4 ms |
1016 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Ok |
2 |
Correct |
1 ms |
336 KB |
Ok |
3 |
Correct |
1 ms |
336 KB |
Ok |
4 |
Incorrect |
1 ms |
336 KB |
Jury has the better answer : jans = 9, pans = 8 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Ok |
5 |
Correct |
1 ms |
564 KB |
Ok |
6 |
Correct |
1 ms |
504 KB |
Ok |
7 |
Correct |
1 ms |
336 KB |
Ok |
8 |
Correct |
1 ms |
420 KB |
Ok |
9 |
Correct |
1 ms |
504 KB |
Ok |
10 |
Correct |
1 ms |
336 KB |
Ok |
11 |
Correct |
1 ms |
336 KB |
Ok |
12 |
Correct |
1 ms |
336 KB |
Ok |
13 |
Correct |
1 ms |
336 KB |
Ok |
14 |
Correct |
1 ms |
336 KB |
Ok |
15 |
Correct |
1 ms |
336 KB |
Ok |
16 |
Incorrect |
1 ms |
336 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Ok |
5 |
Correct |
1 ms |
564 KB |
Ok |
6 |
Correct |
1 ms |
504 KB |
Ok |
7 |
Correct |
1 ms |
336 KB |
Ok |
8 |
Correct |
1 ms |
420 KB |
Ok |
9 |
Correct |
1 ms |
504 KB |
Ok |
10 |
Correct |
1 ms |
336 KB |
Ok |
11 |
Correct |
1 ms |
336 KB |
Ok |
12 |
Correct |
1 ms |
336 KB |
Ok |
13 |
Correct |
1 ms |
336 KB |
Ok |
14 |
Correct |
1 ms |
336 KB |
Ok |
15 |
Correct |
1 ms |
336 KB |
Ok |
16 |
Correct |
1 ms |
336 KB |
Ok |
17 |
Correct |
1 ms |
460 KB |
Ok |
18 |
Correct |
2 ms |
592 KB |
Ok |
19 |
Correct |
7 ms |
1528 KB |
Ok |
20 |
Correct |
5 ms |
848 KB |
Ok |
21 |
Correct |
8 ms |
1360 KB |
Ok |
22 |
Correct |
4 ms |
1016 KB |
Ok |
23 |
Correct |
1 ms |
336 KB |
Ok |
24 |
Correct |
1 ms |
336 KB |
Ok |
25 |
Correct |
1 ms |
336 KB |
Ok |
26 |
Incorrect |
1 ms |
336 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
504 KB |
Ok |
5 |
Correct |
1 ms |
564 KB |
Ok |
6 |
Correct |
1 ms |
504 KB |
Ok |
7 |
Correct |
1 ms |
336 KB |
Ok |
8 |
Correct |
1 ms |
420 KB |
Ok |
9 |
Correct |
1 ms |
504 KB |
Ok |
10 |
Correct |
1 ms |
336 KB |
Ok |
11 |
Correct |
1 ms |
336 KB |
Ok |
12 |
Correct |
1 ms |
336 KB |
Ok |
13 |
Correct |
1 ms |
336 KB |
Ok |
14 |
Correct |
1 ms |
336 KB |
Ok |
15 |
Correct |
1 ms |
336 KB |
Ok |
16 |
Correct |
1 ms |
336 KB |
Ok |
17 |
Correct |
1 ms |
460 KB |
Ok |
18 |
Correct |
2 ms |
592 KB |
Ok |
19 |
Correct |
7 ms |
1528 KB |
Ok |
20 |
Correct |
5 ms |
848 KB |
Ok |
21 |
Correct |
8 ms |
1360 KB |
Ok |
22 |
Correct |
4 ms |
1016 KB |
Ok |
23 |
Correct |
1 ms |
336 KB |
Ok |
24 |
Correct |
1 ms |
336 KB |
Ok |
25 |
Correct |
1 ms |
336 KB |
Ok |
26 |
Incorrect |
1 ms |
336 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |