// Checker by Baoshuo #include #include "testlib.h" const int N = 1e5 + 5; long long n, z, a[N], d[N]; int main(int argc, char *argv[]) { registerTestlibCmd(argc, argv); n = inf.readLong(); z = inf.readLong(); for (int i = 1; i <= n; i++) { d[i] = inf.readLong(); a[i] = inf.readLong(); } std::string pa = ouf.readToken(); std::string ja = ans.readToken(); if (pa != ja) { quitf(_wa, "expected '%s', but got '%s'", ja.c_str(), pa.c_str()); } if (ja == "NIE") quitf(_ok, "correct"); for (int i = 1; i <= n; i++) { int p = ouf.readLong(); z -= d[p]; if (z <= 0) quitf(_wa, "wrong answer"); z += a[p]; } quitf(_ok, "correct"); }