#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 400002;
const int INF = 1e9;
int t;
int n, m;
int ans[N_MAX];
int pref[N_MAX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--)
{
cin >> n >> m;
bool swaped = false;
if(n > m)
{
swap(n, m);
swaped = true;
}
if(n == 1 || m % n == 0)
{
cout << m - 1 << "\n";
for(int i = 1; i <= m - 1; i++)
if(swaped == true)
cout << "1 ";
else
cout << "-1 ";
cout << "\n";
continue;
}
int val = (INF - 1) / (n - 1);
for(int i = 1; i < n; i++)
{
ans[i] = val;
if(i < INF - val * (n - 1))
ans[i]++;
}
ans[n] = -INF;
for(int i = 1; i <= n; i++)
if(swaped == true)
ans[i] *= -1;
cout << m << "\n";
long long s = 0;
for(int i = 1; i <= (m / n + 1) * n - 1; i++)
{
if(i > n)
ans[i] = ans[i - n];
s += ans[i];
cout << ans[i] << " ";
}
cout << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
380 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
5 ms |
248 KB |
Ok |
5 |
Correct |
5 ms |
376 KB |
Ok |
6 |
Correct |
5 ms |
376 KB |
Ok |
7 |
Correct |
5 ms |
376 KB |
Ok |
8 |
Correct |
5 ms |
376 KB |
Ok |
9 |
Correct |
5 ms |
376 KB |
Ok |
10 |
Correct |
5 ms |
376 KB |
Ok |
11 |
Correct |
5 ms |
504 KB |
Ok |
12 |
Correct |
5 ms |
376 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
376 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
5 ms |
376 KB |
Ok |
5 |
Correct |
5 ms |
376 KB |
Ok |
6 |
Correct |
6 ms |
504 KB |
Ok |
7 |
Correct |
11 ms |
1016 KB |
Ok |
8 |
Correct |
8 ms |
632 KB |
Ok |
9 |
Correct |
12 ms |
1016 KB |
Ok |
10 |
Correct |
9 ms |
760 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
376 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Incorrect |
5 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Jury has the better answer : jans = 5, pans = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
380 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
5 ms |
248 KB |
Ok |
5 |
Correct |
5 ms |
376 KB |
Ok |
6 |
Correct |
5 ms |
376 KB |
Ok |
7 |
Correct |
5 ms |
376 KB |
Ok |
8 |
Correct |
5 ms |
376 KB |
Ok |
9 |
Correct |
5 ms |
376 KB |
Ok |
10 |
Correct |
5 ms |
376 KB |
Ok |
11 |
Correct |
5 ms |
504 KB |
Ok |
12 |
Correct |
5 ms |
376 KB |
Ok |
13 |
Correct |
5 ms |
376 KB |
Ok |
14 |
Correct |
5 ms |
376 KB |
Ok |
15 |
Correct |
5 ms |
376 KB |
Ok |
16 |
Incorrect |
5 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
380 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
5 ms |
248 KB |
Ok |
5 |
Correct |
5 ms |
376 KB |
Ok |
6 |
Correct |
5 ms |
376 KB |
Ok |
7 |
Correct |
5 ms |
376 KB |
Ok |
8 |
Correct |
5 ms |
376 KB |
Ok |
9 |
Correct |
5 ms |
376 KB |
Ok |
10 |
Correct |
5 ms |
376 KB |
Ok |
11 |
Correct |
5 ms |
504 KB |
Ok |
12 |
Correct |
5 ms |
376 KB |
Ok |
13 |
Correct |
6 ms |
376 KB |
Ok |
14 |
Correct |
5 ms |
376 KB |
Ok |
15 |
Correct |
5 ms |
376 KB |
Ok |
16 |
Correct |
5 ms |
376 KB |
Ok |
17 |
Correct |
5 ms |
376 KB |
Ok |
18 |
Correct |
6 ms |
504 KB |
Ok |
19 |
Correct |
11 ms |
1016 KB |
Ok |
20 |
Correct |
8 ms |
632 KB |
Ok |
21 |
Correct |
12 ms |
1016 KB |
Ok |
22 |
Correct |
9 ms |
760 KB |
Ok |
23 |
Correct |
5 ms |
376 KB |
Ok |
24 |
Correct |
5 ms |
376 KB |
Ok |
25 |
Correct |
5 ms |
376 KB |
Ok |
26 |
Incorrect |
5 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
380 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
5 ms |
248 KB |
Ok |
5 |
Correct |
5 ms |
376 KB |
Ok |
6 |
Correct |
5 ms |
376 KB |
Ok |
7 |
Correct |
5 ms |
376 KB |
Ok |
8 |
Correct |
5 ms |
376 KB |
Ok |
9 |
Correct |
5 ms |
376 KB |
Ok |
10 |
Correct |
5 ms |
376 KB |
Ok |
11 |
Correct |
5 ms |
504 KB |
Ok |
12 |
Correct |
5 ms |
376 KB |
Ok |
13 |
Correct |
6 ms |
376 KB |
Ok |
14 |
Correct |
5 ms |
376 KB |
Ok |
15 |
Correct |
5 ms |
376 KB |
Ok |
16 |
Correct |
5 ms |
376 KB |
Ok |
17 |
Correct |
5 ms |
376 KB |
Ok |
18 |
Correct |
6 ms |
504 KB |
Ok |
19 |
Correct |
11 ms |
1016 KB |
Ok |
20 |
Correct |
8 ms |
632 KB |
Ok |
21 |
Correct |
12 ms |
1016 KB |
Ok |
22 |
Correct |
9 ms |
760 KB |
Ok |
23 |
Correct |
5 ms |
376 KB |
Ok |
24 |
Correct |
5 ms |
376 KB |
Ok |
25 |
Correct |
5 ms |
376 KB |
Ok |
26 |
Incorrect |
5 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |