本题调试用简易 checker
  • 板块CF474E Pillars
  • 楼主T1EM1E
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/10/14 11:09
  • 上次更新2024/10/14 16:29:50
查看原帖
本题调试用简易 checker
643058
T1EM1E楼主2024/10/14 11:09
#include "testlib.h"
#include <vector>
#include <map>
using namespace std;

int main(int argc, char *argv[]) {
    registerTestlibCmd(argc, argv);

    int n = inf.readInt(), d = inf.readInt();
    vector<int> a = {0};
    for (int i = 1; i <= n; i++) {
        a.push_back(inf.readInt());
    }

    int m = ouf.readInt(), mstd = ans.readInt();
    if (m != mstd) {
        quitf(_wa, "m is not equal to standard answer\n");
    }

    int b, lastb;
    map<int, bool> mp;
    for (int i = 1; i <= m; i++) {
        b = ouf.readInt(1, n);
        if (i == 1) {
            lastb = b;
            continue;
        }
        if (mp[b]) {
            quitf(_wa, "duplicate b_%d\n", i);
        }
        if (abs(a[b] - a[lastb]) < d) {
            quitf(_wa, "on b[%d], abs(a[%d] - a[%d]) is %d less than %d\n",
            i, b, lastb, abs(a[b] - a[lastb]), d);
        }
        lastb = b;
        mp[b] = 1;
    }

    quitf(_ok, "good job\n");
}
2024/10/14 11:09
加载中...