#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 200002;
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)
{
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;
if(m % n == 0)
m--;
cout << m << "\n";
for(int i = 1; i <= m; i++)
{
if(i > n)
ans[i] = ans[i - n];
cout << ans[i] << " ";
}
cout << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Ok |
2 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Ok |
2 |
Correct |
5 ms |
376 KB |
Ok |
3 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
4 |
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 |
380 KB |
Ok |
2 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Ok |
2 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Ok |
2 |
Incorrect |
5 ms |
376 KB |
there is incorrect sequence |
3 |
Halted |
0 ms |
0 KB |
- |