所以这题有spj吗?没有的话我发一个
查看原帖
所以这题有spj吗?没有的话我发一个
141573
yaoxi楼主2022/9/23 10:18

RT。

#include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
using ll = long long;
const int N = 1e6 + 10;
int n, m, k, cnt1, cnt2;
bool vis[N];
int main(int argc, char* argv[]) {
    registerTestlibCmd(argc, argv);
    if (ans.curChar() == 'N') {
        if (ouf.readString() == "NIE") {
            quitf(_ok, "Accepted.");
        } else {
            quitf(_wa, "Answer is NIE but output isn't.");
        }
    } else if (ouf.curChar() == 'N') {
        quitf(_wa, "Output is NIE but answer isn't.");
    }
    if ((cnt1 = ans.readInt()) != (cnt2 = ouf.readInt()))
        quitf(_wa, "Answer count not match: expected %d, found %d.", cnt1, cnt2);
    n = inf.readInt(), k = inf.readInt(), m = inf.readInt();
    for (int i = 0, x; i < cnt1; ++i)
        x = ouf.readInt(1, n, "ans[i]"), vis[x] = true;
    for (int i = 0, u, v; i < m; ++i) {
        u = inf.readInt(), v = inf.readInt();
        if (vis[u] && vis[v])
            quitf(_wa, "Node #%d and #%d are connected.", u, v);
    }
    quitf(_ok, "Accepted.");
    return 0;
}

2022/9/23 10:18
加载中...