0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 18:32:00 +00:00
OI-codes/LibreOJ/115/data/checker.cpp

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

#include "testlib.h"
#define MAXN 200
int flow[MAXN];
int main(int argc, char *argv[])
{
registerTestlibCmd(argc, argv);
std::string pans = ouf.readToken();
std::string jans = ans.readToken();
if (pans != jans)
{
if (jans == "NO")
quitf(_wa, "Jury didn\'t found the answer, but participant found.");
else
quitf(_wa, "Jury found the answer, but participant didn\'t");
}
if (jans == "NO")
quitf(_ok, "OK");
int n = inf.readInt();
int m = inf.readInt();
for (int i = 0; i < m; i++)
{
int s = inf.readInt();
int t = inf.readInt();
int l = inf.readInt();
int r = inf.readInt();
int f = ouf.readInt();
if (!(l <= f && f <= r))
quitf(_wa, "The flow of edge %d should between %d and %d", i + 1, l, r);
flow[s - 1] -= f;
flow[t - 1] += f;
}
for (int i = 0; i < n; i++)
if (flow[i] != 0)
quitf(_wa, "The in-flow of node %d is not equal to its out-flow", i + 1);
quitf(_ok, "OK");
return 0;
}