QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#785202#9799. Magical PaletteGrass_near_home#WA 5ms10736kbC++141.2kb2024-11-26 17:08:332024-11-26 17:08:38

Judging History

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

  • [2024-11-26 17:08:38]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:10736kb
  • [2024-11-26 17:08:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;

bool is_prime[MAXN];
int N,M;
int a[MAXN],b[MAXN];
int c[1001][1001];
void prepare(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++){
        a[i] = i;
    }    
    for(int j = 1; j <= M; j++){
        b[j] = 1 + (j - 1) * N;
    }
    // for(int i = 1; i <= N; i++){
    //     for(int j = 1; j <= M; j++){
    //         c[i][j] = a[i] * b[j] % (N * M);
    //         cout << c[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    if(is_prime[N] && is_prime[M] && N != M){
        cout << "Yes" << "\n";
        for(int i = 1; i <= N; i++){
            cout << a[i] << " ";
        }
        cout << "\n";
        for(int j = 1; j <= M; j++){
            cout << b[j] << " ";
        }
        cout << "\n";
    }
    else cout << "No\n";
}

int main(){
    for(int i = 2; i < MAXN; i++){
        is_prime[i] = 1;
    }    
    for(int i = 2; i < MAXN; i++){
        if(!is_prime[i]) continue;
        for(int j = 2 * i; j < MAXN; j += i){
            is_prime[j] = 0;
        }
    }
    int T;
    cin >> T;
    while(T--){
        prepare();
    }    
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 9932kb

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: 5ms
memory: 10736kb

input:

1
1 1000000

output:

No

result:

wrong answer Wrong Verdict (test case 1)