QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#784975#9799. Magical PalettecolouryWA 35ms3616kbC++23999b2024-11-26 16:28:422024-11-26 16:28:47

Judging History

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

  • [2024-11-26 16:28:47]
  • 评测
  • 测评结果:WA
  • 用时:35ms
  • 内存:3616kb
  • [2024-11-26 16:28:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const char nl = '\n';
  typedef long long ll;
  typedef long double ld;
typedef long long int lli;  
 const int MOD = 1'000'000'007;


void solve(){
int n,m;
cin >> n >> m;
 if(gcd(n,m) != 1){
    cout << "No" << nl;
    return;
 }

 cout << "Yes" << nl;
if(n > m){
    for(int i = 0;i < n;i++){
        cout << i * 2 + 1 << " ";
    }
    cout << nl;
      int j = 0;
while(j < m && (1 << j) <= n * m){
cout << (1 << j) << " ";
j++;
}
for(;j < m;j++){
    cout << 2 * m + 1 + 2 * j << " ";
}
cout << nl;
}else{
    int j = 0;
while(j < n && (1 << j) <= n * m){
cout << (1 << j) << " ";
j++;
}
for(;j < n;j++){
    cout << 2 * m + 1 + 2 * j << " ";
}
cout << nl;
for(int i = 0;i < m;i++){
    cout << i * 2 +  1 << " ";
}
cout << nl;
}

                             
}


int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int t = 1;
cin >> t;
while(t--){
    solve();
}
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 35ms
memory: 3616kb

input:

1
1 1000000

output:

Yes
1 
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 ...

result:

wrong answer Integer parameter [name=b[500001]] equals to 1000001, violates the range [0, 999999] (test case 1)