This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
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';
}
//n - <0
//m - >0
else if (min(n, m) == 2)
{
int q = max(n, m);
cout << q << '\n';
int N = 1'000'000;
if(n < m)
for (int i = 0; i < q; i++)
{
if (i % 2)cout << -(N + 1) << ' ';
else cout << N << ' ';
}
else
for (int i = 0; i < q; i++)
{
if (i % 2)cout << N + 1 << ' ';
else cout << -N << ' ';
}
cout << '\n';
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |