QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#784975 | #9799. Magical Palette | coloury | WA | 35ms | 3616kb | C++23 | 999b | 2024-11-26 16:28:42 | 2024-11-26 16:28:47 |
Judging History
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;
}
详细
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)