QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#784469#9799. Magical PaletteHHCY#WA 363ms57816kbC++20901b2024-11-26 15:06:062024-11-26 15:06:23

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 15:06:23]
  • 评测
  • 测评结果:WA
  • 用时:363ms
  • 内存:57816kb
  • [2024-11-26 15:06:06]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
void sol(){
    int n,m;
    cin>>n>>m;
    if(n==m){
        cout<<"No"<<endl;
        return;
    }
    vector<int>a(n+1),b(m+1);
    set<int>se;
    a[1]=b[1]=1;
    for(int i=2;i<=n;++i)a[i]=a[i-1]+n-1,a[i]%=n*m;
    for(int i=2;i<=m;++i)b[i]=b[i-1]+m-1,b[i]%=n*m;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j){
            int x=a[i]*b[j]%(n*m);
            if(se.count(x)){
                cout<<"No"<<endl;
                return;
            }
            se.insert(x);
        }
    cout<<"Yes"<<endl;
    for(int i=1;i<=n;++i)cout<<a[i]<<' ';
    cout<<endl;
    for(int i=1;i<=m;++i)cout<<b[i]<<' ';
    cout<<endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int T=1;
    cin>>T;
    while(T--)sol();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3528kb

input:

2
2 3
2 2

output:

Yes
1 2 
1 3 5 
No

result:

ok 2 cases (2 test cases)

Test #2:

score: 0
Accepted
time: 363ms
memory: 57816kb

input:

1
1 1000000

output:

Yes
1 
1 0 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 999959 99...

result:

ok 1 cases (1 test case)

Test #3:

score: 0
Accepted
time: 361ms
memory: 57728kb

input:

1
1000000 1

output:

Yes
1 0 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 999959 99995...

result:

ok 1 cases (1 test case)

Test #4:

score: 0
Accepted
time: 170ms
memory: 30412kb

input:

1
2 500000

output:

No

result:

ok 1 cases (1 test case)

Test #5:

score: 0
Accepted
time: 290ms
memory: 53924kb

input:

1
2 499999

output:

Yes
1 2 
1 499999 999997 499997 999995 499995 999993 499993 999991 499991 999989 499989 999987 499987 999985 499985 999983 499983 999981 499981 999979 499979 999977 499977 999975 499975 999973 499973 999971 499971 999969 499969 999967 499967 999965 499965 999963 499963 999961 499961 999959 499959 99...

result:

ok 1 cases (1 test case)

Test #6:

score: 0
Accepted
time: 129ms
memory: 30480kb

input:

1
500000 2

output:

No

result:

ok 1 cases (1 test case)

Test #7:

score: 0
Accepted
time: 314ms
memory: 53892kb

input:

1
499999 2

output:

Yes
1 499999 999997 499997 999995 499995 999993 499993 999991 499991 999989 499989 999987 499987 999985 499985 999983 499983 999981 499981 999979 499979 999977 499977 999975 499975 999973 499973 999971 499971 999969 499969 999967 499967 999965 499965 999963 499963 999961 499961 999959 499959 999957 ...

result:

ok 1 cases (1 test case)

Test #8:

score: 0
Accepted
time: 80ms
memory: 21256kb

input:

1
3 333333

output:

No

result:

ok 1 cases (1 test case)

Test #9:

score: -100
Wrong Answer
time: 115ms
memory: 26548kb

input:

1
3 333332

output:

No

result:

wrong answer Wrong Verdict (test case 1)