0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 19:52:02 +00:00
OI-codes/BZOJ/3709/data/spj.cpp

41 lines
773 B (Stored with Git LFS)
C++

// Checker by Baoshuo <i@baoshuo.ren>
#include <utility>
#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");
}