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;
for(;t;t--){
int n,m;
cin>>n>>m;
if(n==m){
cout<<0<<"\n";
continue;
}
if(n%m==0){
cout<<n-1<<"\n";
for(int i=0;i<n-1;i++){
cout<<1<<" ";
}
cout<<"\n";
continue;
}
if(m%n==0){
cout<<m-1<<"\n";
for(int i=0;i<m-1;i++){
cout<<-1<<" ";
}
cout<<"\n";
continue;
}
}
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... |