今天我脑袋更浆糊似的,敲了一串神秘代码:
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 2;
int n, m;
int a[N], b[N];
// 这个judge 写的是什么玩意儿!
bool judge(int x) {
if (x == 0 || x == 1) return 0;
if (x == 2) return 1;
for (int i = 2; i * i <= n; i++)
if (n % i) return 0;
return 1;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T;
cin >> T;
while (T--) {
cin >> n >> m;
map<int, int> mm;
for (int i = 1, x; i <= n; i++) {
cin >> x;
if (x == 1) continue;
mm[x]++;
}
for (int i = 1, x; i <= m; i++) {
cin >> x;
if (x == 1) continue;
mm[x]--;
}
int tot = 0, mark = 0;
for (auto t : mm) {
if (t.second != 0) mark = t.first, tot += t.second;
if (tot > 1) {
cout << "NO\n";
goto loto;
}
}
cout << (judge(mark) ? "YES\n" : "NO\n");
loto:;
}
return 0;
}
结果,令我没想到的是,它竟然拿了 69 分!