0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 16:18:49 +00:00
OI-codes/Luogu/T275388/samples/checker.cpp

72 lines
1.7 KiB (Stored with Git LFS)
C++

#include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
using pii = pair<int, int>;
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
int n = inf.readInt(1, 200000, "n");
int m = inf.readInt(0, 200000, "m");
int p = ouf.readInt(-1, 200000, "p");
if (p == -1) {
quitf(_wa, "Judge has answer, but participant has not.");
}
int s = ouf.readInt(0, 200000, "s");
if (s + s + p != n) {
quitf(_wa, "City num not eq %d.", n);
}
static set<pii> st;
while (m--) {
int u = inf.readInt(1, n, "u");
int v = inf.readInt(1, n, "v");
if (u > v) {
swap(u, v);
}
st.insert(pii{u, v});
}
auto check = [&](int u, int v) {
if (u > v) swap(u, v);
return st.find(pii{u, v}) != st.end();
};
static int col[200010];
vector<int> vt;
for (int i = 0; i < p; ++i) {
int u = ouf.readInt(1, n, "u");
col[u] = 1;
vt.push_back(u);
}
for (int i = 0; i < s; ++i) {
int u = ouf.readInt(1, n, "u");
col[u] = 2;
}
for (int i = 0; i < s; ++i) {
int u = ouf.readInt(1, n, "u");
col[u] = 3;
}
for (int i = 1; i <= n; ++i) {
if (col[i] == 0) {
quitf(_wa, "Some city is not colored.");
}
}
for (int i = 1; i < vt.size(); ++i) {
if (not check(vt[i - 1], vt[i])) {
quitf(_wa, "%d %d Not a path.", vt[i - 1], vt[i]);
}
}
for (auto it = st.begin(); it != st.end(); ++it) {
int u = it->first, v = it->second;
if (col[u] + col[v] == 5) {
quitf(_wa, "Two set is not departed.");
}
}
quitf(_ok, "The answer is correct.");
return 0;
}