提供 SPJ
查看原帖
提供 SPJ
555825
block_in_mc楼主2024/8/25 10:50
#include "testlib.h"

char change(char c) {
	if (c == '+') return '-';
	return '+';
}

int main(int argc, char* argv[]) {
	registerTestlibCmd(argc, argv);
	
	std::string f[5];
	for (int i = 1; i <= 4; i++) {
		f[i] = inf.readString();
		f[i] = " " + f[i];
	}
	
	int res = ouf.readInt(), cans = ans.readInt();
	if (res != cans) quitf(_wa, "Your answer is wrong.");
	for (int i = 1; i <= res; i++) {
		int x = ouf.readInt(), y = ouf.readInt();
		if (x < 1 || x > 4 || y < 1 || y > 4) quitf(_wa, "Your plan chooses a place that does not exist.");
		f[x][y] = change(f[x][y]);
		for (int j = 1; j <= 4; j++) if (j != y) f[x][j] = change(f[x][j]);
		for (int j = 1; j <= 4; j++) if (j != x) f[j][y] = change(f[j][y]);
	}
	
	bool flag = true;
	for (int i = 1; i <= 4; i++)
		for (int j = 1; j <= 4; j++)
			if (f[i][j] == '+')
				flag = false;
	if (!flag) quitf(_wa, "Your plan is wrong.");
	quitf(_ok, "Correct answer!");
	return 0;
}
2024/8/25 10:50
加载中...