//#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define ld long double
#define sqr(x) (x) * (x)
using namespace std;
using namespace __gnu_pbds;
int main()
{
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // LOCAL
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
for(int ii = 0; ii < t; ++ii)
{
int n, m;
cin >> n >> m;
if (max(n, m) % min(n, m) == 0)
{
cout << max(n, m) - 1 << '\n';
if (n < m)
for(int i = 0; i < max(n, m) - 1; ++i)
cout << -1 << ' ';
else
for(int i = 0; i < max(n, m) - 1; ++i)
cout << 1 << ' ';
cout << '\n';
}
else
{
cout << max(n, m) << '\n';
if (n < m)
for(int i = 0; i < max(n, m); ++i)
if (i % 2 == 0)
cout << 200000000 << ' ';
else
cout << -200000001 << ' ';
else
for(int i = 0; i < max(n, m); ++i)
if (i % 2 == 0)
cout << -200000000 << ' ';
else
cout << 200000001 << ' ';
cout << '\n';
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
256 KB |
Ok |
6 |
Correct |
2 ms |
256 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
296 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
0 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
376 KB |
Ok |
6 |
Correct |
3 ms |
504 KB |
Ok |
7 |
Correct |
9 ms |
888 KB |
Ok |
8 |
Correct |
5 ms |
632 KB |
Ok |
9 |
Correct |
11 ms |
1016 KB |
Ok |
10 |
Correct |
7 ms |
744 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 5, pans = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
256 KB |
Ok |
6 |
Correct |
2 ms |
256 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
296 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
2 ms |
376 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
256 KB |
Ok |
6 |
Correct |
2 ms |
256 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
296 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
2 ms |
380 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Correct |
0 ms |
376 KB |
Ok |
17 |
Correct |
2 ms |
376 KB |
Ok |
18 |
Correct |
3 ms |
504 KB |
Ok |
19 |
Correct |
9 ms |
888 KB |
Ok |
20 |
Correct |
5 ms |
632 KB |
Ok |
21 |
Correct |
11 ms |
1016 KB |
Ok |
22 |
Correct |
7 ms |
744 KB |
Ok |
23 |
Correct |
2 ms |
376 KB |
Ok |
24 |
Correct |
2 ms |
376 KB |
Ok |
25 |
Correct |
2 ms |
376 KB |
Ok |
26 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
256 KB |
Ok |
6 |
Correct |
2 ms |
256 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
296 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
2 ms |
380 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Correct |
0 ms |
376 KB |
Ok |
17 |
Correct |
2 ms |
376 KB |
Ok |
18 |
Correct |
3 ms |
504 KB |
Ok |
19 |
Correct |
9 ms |
888 KB |
Ok |
20 |
Correct |
5 ms |
632 KB |
Ok |
21 |
Correct |
11 ms |
1016 KB |
Ok |
22 |
Correct |
7 ms |
744 KB |
Ok |
23 |
Correct |
2 ms |
376 KB |
Ok |
24 |
Correct |
2 ms |
376 KB |
Ok |
25 |
Correct |
2 ms |
376 KB |
Ok |
26 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |