QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#784851#9799. Magical PaletteXiaoYang3WA 86ms42396kbC++231.1kb2024-11-26 16:08:572024-11-26 16:08:57

Judging History

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

  • [2024-11-26 16:08:57]
  • 评测
  • 测评结果:WA
  • 用时:86ms
  • 内存:42396kb
  • [2024-11-26 16:08:57]
  • 提交

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)