QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#19240#2405. Tic-Tac StateQingyuWA 4ms3712kbC++201.4kb2022-01-28 16:08:142022-05-06 04:30:00

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 04:30:00]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3712kb
  • [2022-01-28 16:08:14]
  • 提交

answer

#include <bits/stdc++.h>

int map[3][3];
char s[1005];

int main() {
	int T;
	scanf("%d", &T);
	while (T--) {
		int S;
		scanf("%o", &S);
		bool finished = true;
		for (int i = 0; i < 3; ++i) 
			for (int j = 0; j < 3; ++j) {
				int o = 3 * i + j;
				if (S >> o & 1)	
					map[i][j] = 0;
				else {
					map[i][j] = -1;
					finished = false;
				}
			}
		for (int i = 0; i < 3; ++i) 
			for (int j = 0; j < 3; ++j) {
				int o = 3 * i + j;
				if (map[i][j] == 0) {
					if (S >> o + 9 & 1)
						map[i][j] = 2;
					else 
						map[i][j] = 1;
				}
			}
		auto solve = [&]() {
			for (int i = 0; i < 3; ++i) {
				bool ok = true;
				for (int j = 1; j < 3; ++j) {
					if (map[i][0] != map[i][j]) {
						ok = false;
					}
				}
				if (ok) return map[i][0];
			}
			for (int i = 0; i < 3; ++i) {
				bool ok = true;
				for (int j = 1; j < 3; ++j) {
					if (map[0][i] != map[j][i]) {
						ok = false;
					}
				}
				if (ok) return map[i][0];
			}
			if (map[0][0] == map[1][1] && map[1][1] == map[2][2])
				return map[1][1];
			if (map[0][2] == map[1][1] && map[1][1] == map[2][0])
				return map[1][1];
			return -1;
		};
		int o = solve();
		if (o == -1) {
			if (!finished) {
				puts("In progress");
			}
			else {
				puts("Cat's");
			}
		}
		else if (o == 1) puts("O wins");
		else puts("X wins");
	}
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 3708kb

input:

4
01116777
07037
01416777
050055

output:

O wins
X wins
Cat's
In progress

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 3ms
memory: 3660kb

input:

1
00

output:

In progress

result:

ok single line: 'In progress'

Test #3:

score: -100
Wrong Answer
time: 4ms
memory: 3712kb

input:

5477
01000004
01000001
01000002
01000010
020021
01020025
020022
01020026
020024
01000020
01020023
01020034
020030
01020031
01020032
040041
01040045
040042
01040046
040044
01000040
01040043
01040054
040050
01040051
01040052
01020064
01040064
040060
020060
060063
01060067
060065
01020061
01040061
0600...

output:

In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
In progress
...

result:

wrong answer 54th lines differ - expected: 'In progress', found: 'O wins'