QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#784438#9799. Magical PaletteVocal#WA 9ms27060kbC++234.2kb2024-11-26 15:00:312024-11-26 15:00:32

Judging History

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

  • [2024-11-26 15:00:32]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:27060kb
  • [2024-11-26 15:00:31]
  • 提交

answer

// #include<bits/stdc++.h>
// using namespace std;
// #define int long long
// int vis[200];
// signed main() {
//     for(int i = 1;i <= 20; ++i) {
//         for(int j = i+1;j <= 20; ++j) {
//             for(int k = j+1;k <= 20; ++k) {
//                 for(int x = k+1;x <= 20; ++x)
//                     for(int y = x+1;y <= 20; ++y)
//                         for(int z = y+1;z <= 20; ++z)
//                             for(int c = z+1;c <= 20; ++c)
//                                 for(int v = c+1;v <= 20; ++v)
//                                     for(int n = v+1;n <= 20; ++n)
//
//                 for(int i1 = 1;i1 <= 20; ++i1) {
//                     for(int j1 = i1+1;j1 <= 20; ++j1) {
//                         for(int c1 = j1+1;c1 <= 20; ++c1)
//                             for(int v1 = c1+1;v1 <= 20; ++v1)
//                                 for(int n1 = v1+1;n1 <= 20; ++n1)
//                         for(int k1 = j1+1;k1 <= 20; ++k1) {
//                             memset(vis,0,sizeof(vis));
//                             int num = 0;
//                             int a[20];
//                             a[1] = i,a[2] = j,a[3] = k,a[4] = x,a[5] = y,a[6] = z,a[7] = c;
//                             a[8] = v,a[9] = n;
//                             //a[10] = m;
//                             int b[20];
//                             b[1] = i1,b[2] = j1,b[3] = c1,b[4] = v1,b[5] = n1,b[6] = k1;
//                             for(int l = 1;l <= 9; ++l) {
//                                 for(int l1 = 1;l1 <= 6; ++l1) {
//                                     if( vis[a[l]*b[l1]%54] )break;
//                                     vis[a[l]*b[l1]%54] = 1;
//                                     num++;
//                                 }
//                             }
//                             if( num == 54 ) {
//                                 for(int l = 1;l <= 9; ++l)cout << a[l] << " ";
//                                 cout <<endl;
//                                 for(int l = 1;l <= 6; ++l)cout << b[l] << " ";
//                                 cout << endl;
//
//                             }
//                         }
//                     }
//                 }
//             }
//         }
//     }
//     return 0;
// }
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[1000010];
int b[1000010];
int num[1000010];
signed main() {
    int t;
    cin>>t;
    while(t--) {
        int n,m;
        cin>>n>>m;
        
        if(gcd(n,m)!=1) {
            cout<<"No"<<endl;
            continue;
        }
        for(int i = 0;i <= n*m+5; ++i)a[i] = b[i] = num[i] = 0;
        cout<<"Yes"<<endl;

        int cnt=1;
        a[1]=1;

        cout<<1<<" ";
        for(int i=2;i<n*m;i++) {
            if(i%m!=0&&!a[i%n]) {
                a[i%n]=1;
                cout<<i<<" ";
                num[i]=1;
                cnt++;
                if(cnt==n)break;
            }
        }
        cout<<endl;
        cnt=1;
        cout<<1<<" ";
        b[1]=1;
        for(int i=2;i<n*m;i++) {
            if(!num[i]&&i%n!=0&&!b[i%m]) {
                b[i%m]=1;
                cout<<i<<" ";
                cnt++;
                if(cnt==m)break;
            }
        }

    }
}
/*
1 2 4 5 7 8 10 13 16 19
1 3 11
1 2 4 5 7 8 10 13 16 19
1 9 11
1 2 4 5 7 8 10 13 16 19
3 7 17
1 2 4 5 7 8 10 13 16 19
3 11 19
1 2 4 5 7 8 10 13 16 19
3 13 17
1 2 4 5 7 8 10 13 16 19
7 9 17
1 2 4 5 7 8 10 13 16 19
9 11 19
1 2 4 5 7 8 10 13 16 19
9 13 17
1 2 4 5 7 8 13 16 19 20
1 3 11
1 2 4 5 7 8 13 16 19 20
1 9 11
1 2 4 5 7 8 13 16 19 20
3 7 17
1 2 4 5 7 8 13 16 19 20
3 11 19
1 2 4 5 7 8 13 16 19 20
3 13 17
1 2 4 5 7 8 13 16 19 20
7 9 17
1 2 4 5 7 8 13 16 19 20
9 11 19
1 2 4 5 7 8 13 16 19 20
9 13 17
1 2 4 5 8 10 13 16 17 19
1 3 11
1 2 4 5 8 10 13 16 17 19
1 9 11
1 2 4 5 8 10 13 16 17 19
3 7 17
1 2 4 5 8 10 13 16 17 19
7 9 17
1 2 4 5 8 13 16 17 19 20
1 3 11
1 2 4 5 8 13 16 17 19 20
1 9 11
1 2 4 5 8 13 16 17 19 20
3 7 17
1 2 4 5 8 13 16 17 19 20
7 9 17
1 2 5 7 8 10 13 14 16 19
1 3 11
1 2 5 7 8 10 13 14 16 19
1 9 11
1 2 5 7 8 10 13 14 16 19
3 7 17
1 2 5 7 8 10 13 14 16 19
7 9 17
1 2 5 7 8
 */

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 7692kb

input:

2
2 3
2 2

output:

Yes
1 2 
1 3 5 No

result:

ok 2 cases (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 9ms
memory: 27060kb

input:

1
1 1000000

output:

Yes
1 2 
1 

result:

wrong output format Unexpected end of file - int32 expected (test case 1)