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 <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, m;
cin >> n >> m;
if(min(n,m) == 2){
int x = max(n,m)-(max(n,m) % 2 == 0);
cout << x << "\n";
if(n < m){
for(int i = 1; i <= x; i++){
if(i % 2 == 1) cout << x << ' ';
else cout << -(x+1) << ' ';
}
}
else {
for(int i = 1; i <= x; i++){
if(i % 2 == 1) cout << -(x) << ' ';
else cout << x+1 << ' ';
}
}
}
else {
if(n < m){
cout << m-1 << '\n';
for(int i = 1; i < m; i++){
cout << -1 << ' ';
}
}
else {
cout << n-1 << "\n";
for(int i = 1; i < n; i++){
cout << 1 << ' ';
}
}
}
cout << '\n';
}
}
# | 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... |