QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#780160 | #9799. Magical Palette | John | WA | 0ms | 3636kb | C++23 | 2.2kb | 2024-11-25 02:32:03 | 2024-11-25 02:32:03 |
Judging History
answer
#include <assert.h>
#include <bits/stdc++.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <complex>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define IOS() \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define OK() cout << "OK" << endl
#define range(x) x.begin(), x.end()
#define lowbit(x) (x & (-x))
#define pii pair<int, int>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
const LL INF64 = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
vector<vector<int>> adj;
vector<bool> vis;
int n, m;
bool isprime(int num) {
for (int i = 2; i <= num / 2; i++)
if (num % i == 0) return false;
return true;
}
void solve() {
cin >> n >> m;
if (n == 1 && m == 1) {
cout << "Yes" << endl;
cout << 1 << endl;
return;
}
if (n == 1) {
cout << "Yes" << endl;
cout << 1 << endl;
for (int i = 1; i <= n; i++) cout << i << ' ';
cout << endl;
return;
}
if (m == 1) {
cout << "Yes" << endl;
for (int i = 1; i <= n; i++) cout << i << ' ';
cout << endl;
cout << 1 << endl;
return;
}
if (n == m) {
cout << "No" << endl;
return;
}
if (isprime(n) and isprime(m)) {
cout << "Yes" << endl;
if (n > m) {
for (int i = 1; i <= n; i++) cout << 1 + m * (i - 1) << ' ';
cout << endl;
for (int i = 1; i <= m; i++) cout << i << ' ';
cout << endl;
return;
} else if (n < m) {
for (int i = 1; i <= n; i++) cout << i << ' ';
cout << endl;
for (int i = 1; i <= m; i++) cout << 1 + n * (i - 1) << ' ';
cout << endl;
return;
}
}
cout << "No" << endl;
}
signed main() {
IOS();
// freopen("in.text","r",stdin);
// freopen("out.text","w",stdout);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
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: 0ms
memory: 3544kb
input:
1 1 1000000
output:
Yes 1 1
result:
wrong output format Unexpected end of file - int32 expected (test case 1)