0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 15:18:53 +00:00
OI-codes/LibreOJ/3500/data/checker.cpp

42 lines
1.0 KiB (Stored with Git LFS)
C++

// Author: HeRaNO
#include "testlib.h"
#define MAXN 305
const int MAX = 1000000;
int a[MAXN][MAXN], b[MAXN][MAXN];
int main(int argc, char *argv[])
{
registerTestlibCmd(argc, argv);
int T = inf.readInt();
for (int cas = 1; cas <= T; cas++)
{
int n = inf.readInt();
int m = inf.readInt();
for (int i = 1; i < n; i++)
for (int j = 1; j < m; j++)
b[i][j] = inf.readInt();
std::string pans = ouf.readToken("YES|NO");
std::string jans = ans.readToken();
if (pans != jans)
quitf(_wa, "%s is expected in answer, but found %s (case #%d)", jans.c_str(), pans.c_str(), cas);
if (pans == "NO")
continue;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
a[i][j] = ouf.readInt(0, MAX), ans.readInt();
for (int i = 1; i < n; i++)
for (int j = 1; j < m; j++)
if (b[i][j] != a[i][j] + a[i][j + 1] + a[i + 1][j] + a[i + 1][j + 1])
quitf(_wa, "array a does not meet the requirement (case #%d)", i);
}
quitf(_ok, "ok");
return 0;
}