QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#784851 | #9799. Magical Palette | XiaoYang3 | WA | 86ms | 42396kb | C++23 | 1.1kb | 2024-11-26 16:08:57 | 2024-11-26 16:08:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e5 + 5;
const ll P = 998244353;
ll m, n, x;
int a[N * 10], b[N * 10];
void solve() {
cin >> n >> m;
vector<int> a;
for (int ct = 1; ct <= n; ct++) {
a.push_back((ct * m - 1) % (n * m));
}
vector<int> b;
int now = 1;
for (int ct = 1; ct <= m; ct++) {
b.push_back(now);
now += n;
// now += ct - 1;
now %= (n * m);
}
set<int> se;
for (auto x : a) {
for (auto y : b) {
se.insert((x * y) % (n * m));
}
}
if (se.size() == m * n) {
cout << "Yes\n";
for (auto x : a) {
cout << x << ' ';
}
cout << '\n';
for (auto x : b) {
cout << x << ' ';
}
cout << '\n';
} else {
cout << "No\n";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int _ = 1;
cin >> _;
while (_--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
2 2 3 2 2
output:
Yes 2 5 1 3 5 No
result:
ok 2 cases (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 86ms
memory: 42396kb
input:
1 1 1000000
output:
No
result:
wrong answer Wrong Verdict (test case 1)