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 <stdio.h>
using namespace std;
void SubTaskOne(int n, int m);
void SubTaskTwo(int n, int m);
void SubTaskThree(int n, int m);
void SubTaskFour(int n, int m);
int main()
{
int T, n, m;
cin>>T;
while (T--)
{
cin>>n>>m;
if (max(n, m)%min(n, m)==0)
SubTaskOne(n, m);
else if (max(n, m)<=10000 && min(n, m)==2)
SubTaskTwo(n, m);
else if (max(n, m)<=10)
SubTaskThree(n, m);
else if (max(n, m)-min(n, m)<=2)
SubTaskFour(n, m);
else
return 0;
}
char I;
cin >> I;
return 0;
}
void SubTaskOne(int n, int m)
{
int fillNum=(n%m==0)?1:-1;
cout<<max(n, m)-1<<'\n';
for (int i=1; i<max(n, m); i++)
printf("%d ", fillNum);
cout<<'\n';
}
void SubTaskTwo(int n, int m)
{
if (n==2)
{
cout<<m<<'\n';
for (int i=0; i<m; i++)
if (i%2)
printf("%d ", -m);
else
printf("%d ", m-1);
}
else
{
cout<<n<<'\n';
for (int i=0; i<n; i++)
if (i%2)
printf("%d ", n);
else
printf("%d ", -n+1);
}
cout<<'\n';
}
void SubTaskThree(int n, int m)
{
}
void SubTaskFour(int n, int m)
{
}
# | 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... |