#include <bits/stdc++.h>
using ll = long long;
using std::vector;
using std::array;
using std::pair;
using std::tuple;
vector<int> solve(const int N, const int M) {
if (M % N == 0) {
return vector(M - 1, -1);
}
vector<int> ret(M, M - 1);
for (int i = N - 1; i < M; i += N) {
ret[i] = -M;
}
return ret;
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int T;
std::cin >> T;
while (T--) {
int N, M;
std::cin >> N >> M;
vector<int> A;
if (N > M) {
A = solve(M, N);
for (auto& x : A) {
x = -x;
}
} else {
A = solve(N, M);
}
std::cout << A.size() << '\n';
for (int i = 0; i < (int)A.size(); ++i) {
if (i > 0) {
std::cout << ' ';
}
std::cout << A[i];
}
std::cout << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
0 ms |
212 KB |
Ok |
8 |
Correct |
1 ms |
212 KB |
Ok |
9 |
Correct |
1 ms |
212 KB |
Ok |
10 |
Correct |
0 ms |
212 KB |
Ok |
11 |
Correct |
1 ms |
212 KB |
Ok |
12 |
Correct |
0 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
2 ms |
340 KB |
Ok |
7 |
Correct |
7 ms |
576 KB |
Ok |
8 |
Correct |
3 ms |
468 KB |
Ok |
9 |
Correct |
8 ms |
724 KB |
Ok |
10 |
Correct |
6 ms |
480 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
324 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Incorrect |
0 ms |
320 KB |
Jury has the better answer : jans = 9, pans = 8 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
0 ms |
212 KB |
Ok |
8 |
Correct |
1 ms |
212 KB |
Ok |
9 |
Correct |
1 ms |
212 KB |
Ok |
10 |
Correct |
0 ms |
212 KB |
Ok |
11 |
Correct |
1 ms |
212 KB |
Ok |
12 |
Correct |
0 ms |
212 KB |
Ok |
13 |
Correct |
0 ms |
212 KB |
Ok |
14 |
Correct |
1 ms |
324 KB |
Ok |
15 |
Correct |
1 ms |
212 KB |
Ok |
16 |
Incorrect |
0 ms |
320 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
0 ms |
212 KB |
Ok |
8 |
Correct |
1 ms |
212 KB |
Ok |
9 |
Correct |
1 ms |
212 KB |
Ok |
10 |
Correct |
0 ms |
212 KB |
Ok |
11 |
Correct |
1 ms |
212 KB |
Ok |
12 |
Correct |
0 ms |
212 KB |
Ok |
13 |
Correct |
0 ms |
212 KB |
Ok |
14 |
Correct |
1 ms |
212 KB |
Ok |
15 |
Correct |
0 ms |
212 KB |
Ok |
16 |
Correct |
0 ms |
212 KB |
Ok |
17 |
Correct |
0 ms |
212 KB |
Ok |
18 |
Correct |
2 ms |
340 KB |
Ok |
19 |
Correct |
7 ms |
576 KB |
Ok |
20 |
Correct |
3 ms |
468 KB |
Ok |
21 |
Correct |
8 ms |
724 KB |
Ok |
22 |
Correct |
6 ms |
480 KB |
Ok |
23 |
Correct |
0 ms |
212 KB |
Ok |
24 |
Correct |
1 ms |
324 KB |
Ok |
25 |
Correct |
1 ms |
212 KB |
Ok |
26 |
Incorrect |
0 ms |
320 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
0 ms |
212 KB |
Ok |
8 |
Correct |
1 ms |
212 KB |
Ok |
9 |
Correct |
1 ms |
212 KB |
Ok |
10 |
Correct |
0 ms |
212 KB |
Ok |
11 |
Correct |
1 ms |
212 KB |
Ok |
12 |
Correct |
0 ms |
212 KB |
Ok |
13 |
Correct |
0 ms |
212 KB |
Ok |
14 |
Correct |
1 ms |
212 KB |
Ok |
15 |
Correct |
0 ms |
212 KB |
Ok |
16 |
Correct |
0 ms |
212 KB |
Ok |
17 |
Correct |
0 ms |
212 KB |
Ok |
18 |
Correct |
2 ms |
340 KB |
Ok |
19 |
Correct |
7 ms |
576 KB |
Ok |
20 |
Correct |
3 ms |
468 KB |
Ok |
21 |
Correct |
8 ms |
724 KB |
Ok |
22 |
Correct |
6 ms |
480 KB |
Ok |
23 |
Correct |
0 ms |
212 KB |
Ok |
24 |
Correct |
1 ms |
324 KB |
Ok |
25 |
Correct |
1 ms |
212 KB |
Ok |
26 |
Incorrect |
0 ms |
320 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |