#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9-1;
int t;
int n, m;
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(2 * n <= m || 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 / (n - 1);
int sum = val * (n - 1);
cout << m << "\n";
for(int i = 1; i <= m; i++)
{
int out = val;
if(i == n)
out = -1 - sum;
if(swaped == true)
out *= -1;
cout << out << " ";
}
cout << "\n";
}
return 0;
}
# |
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 |
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 |
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 |
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 |
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 |
- |