QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#784500 | #9799. Magical Palette | WilliamHu | WA | 0ms | 3532kb | C++17 | 822b | 2024-11-26 15:10:43 | 2024-11-26 15:10:44 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int read()
{
int x = 0, f = 1;
char c = getchar();
while(c != EOF and !isdigit(c))
{
if(c == '-')f = -1;
c = getchar();
}
while(isdigit(c))
{
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
int n, m;
signed main()
{
int T = read();
while(T --)
{
n = read();
m = read();
int d = __gcd(n, m);
if(d != 1)
{
cout<<"No\n";
continue;
}
cout<<"Yes\n";
if(n < m)
{
for(int i = 0;i < n;i ++)cout<<i<<' ';
cout<<'\n';
for(int i = 0;i < m;i ++)cout<<1+i*n<<' ';
cout<<endl;
}
else
{
for(int i = 0;i < n;i ++)cout<<1+i*m<<' ';
cout<<'\n';
for(int i = 0;i < m;i ++)cout<<i<<' ';
cout<<endl;
}
}
return 0;
}
//8
//1 2 3 1 3 4 3
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3532kb
input:
2 2 3 2 2
output:
Yes 0 1 1 3 5 No
result:
wrong answer Duplicated Color 0 (test case 1)