#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define sc second
#define pb push_back
#define in insert
void dambo_12() {
int n , m; cin>>n>>m;
if (n % m == 0) {
cout<<n - 1<<'\n';
for (int i = 1; i < n; i++)
cout<<1<<' ';
cout<<'\n';
}
else if (m % n == 0){
cout<<m - 1<<'\n';
for (int i = 1; i < m; i++)
cout<<-1<<' ';
cout<<'\n';
}
else if (n > m){
int cnt = ((n + m - 1) / m) * m - 1;
cout<<cnt<<'\n';
for (int i = 1; i <= cnt; i++) {
if (i % m == 0) {
cout<<(m - 1) * 10000 + 1<<" ";
}
else {
cout<<-10000<<" ";
}
}
cout<<'\n';
}
else {
int cnt = ((m + n - 1) / n) * n - 1;
cout<<cnt<<'\n';
for (int i = 1; i <= cnt; i++) {
if (i % n == 0) {
cout<<(n - 1) * (-10000) - 1<<" ";
}
else {
cout<<10000<<" ";
}
}
cout<<'\n';
}
return;
}
int32_t main () {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll o = 1; cin>>o;
while (o--) {
dambo_12();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
1 ms |
316 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Correct |
1 ms |
324 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Ok |
2 |
Correct |
0 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 |
2 ms |
340 KB |
Ok |
7 |
Correct |
7 ms |
596 KB |
Ok |
8 |
Correct |
4 ms |
508 KB |
Ok |
9 |
Correct |
10 ms |
724 KB |
Ok |
10 |
Correct |
5 ms |
468 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
320 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
316 KB |
Jury has the better answer : jans = 6, pans = 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
1 ms |
316 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Correct |
1 ms |
324 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 |
212 KB |
Ok |
16 |
Incorrect |
1 ms |
212 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
1 ms |
316 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Correct |
1 ms |
324 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 |
212 KB |
Ok |
14 |
Correct |
0 ms |
212 KB |
Ok |
15 |
Correct |
0 ms |
212 KB |
Ok |
16 |
Correct |
1 ms |
212 KB |
Ok |
17 |
Correct |
0 ms |
212 KB |
Ok |
18 |
Correct |
2 ms |
340 KB |
Ok |
19 |
Correct |
7 ms |
596 KB |
Ok |
20 |
Correct |
4 ms |
508 KB |
Ok |
21 |
Correct |
10 ms |
724 KB |
Ok |
22 |
Correct |
5 ms |
468 KB |
Ok |
23 |
Correct |
1 ms |
320 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
1 ms |
316 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Correct |
1 ms |
324 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 |
212 KB |
Ok |
14 |
Correct |
0 ms |
212 KB |
Ok |
15 |
Correct |
0 ms |
212 KB |
Ok |
16 |
Correct |
1 ms |
212 KB |
Ok |
17 |
Correct |
0 ms |
212 KB |
Ok |
18 |
Correct |
2 ms |
340 KB |
Ok |
19 |
Correct |
7 ms |
596 KB |
Ok |
20 |
Correct |
4 ms |
508 KB |
Ok |
21 |
Correct |
10 ms |
724 KB |
Ok |
22 |
Correct |
5 ms |
468 KB |
Ok |
23 |
Correct |
1 ms |
320 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 |
- |