QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#101641#6380. LaLa and Divination Magicwillow#WA 3ms7900kbC++141.1kb2023-04-30 16:15:132023-04-30 16:15:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-30 16:15:15]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:7900kb
  • [2023-04-30 16:15:13]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn = 2005;
char s[maxn][maxn];
int n, m;
bitset<maxn>w[maxn][2], f[2][2][maxn];
vector<pair<pair<int, int>, int> > ans;
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; ++ i) {
		scanf("%s", s[i]);
		for(int j = 0; j < m; ++ j) {
			w[i][s[i][j] - '0'][j] = 1;
		}
		for(int j = 0; j < m; ++ j) {
			if(s[i][j] - '0') {
				f[1][0][j] |= w[i][0];
				f[1][1][j] |= w[i][1];
			}
			else {
				f[0][0][j] |= w[i][0];
				f[0][1][j] |= w[i][1];
			}
		}
	}
	for(int i = 0; i < m; ++ i)
		for(int j = i; j < m; ++ j) {
			int c = 0;
			for(int a = 0; a < 2; ++ a)
				for(int b = 0; b < 2; ++ b)
					if(f[a][b][i][j])
						++ c;
			if(c == 4)
				return 0 * puts("-1");
		}
	for(int a = 0; a < 2; ++ a)
		for(int b = 0; b < 2; ++ b)
			for(int i = 0; i < m; ++ i)
				for(int j = i; j < m; ++ j) {
					if(i == j && a != b)
						continue;
					if(f[a ^ 1][b ^ 1][i][j])
						continue;
					ans.push_back({{i, j}, a + b * 2 + 1});
				}
	printf("%d\n", (int)ans.size());
	for(auto w : ans)
		printf("%d %d %d\n", w.first.first, w.first.second, w.second);
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5848kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #2:

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

input:

3 3
101
011
111

output:

6
0 2 3
1 2 3
0 1 4
0 2 4
1 2 4
2 2 4

result:

ok Kout = 6, Kans = 6

Test #3:

score: 0
Accepted
time: 2ms
memory: 7668kb

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #4:

score: 0
Accepted
time: 0ms
memory: 5852kb

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #5:

score: 0
Accepted
time: 0ms
memory: 5848kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #6:

score: 0
Accepted
time: 2ms
memory: 5668kb

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #7:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #8:

score: 0
Accepted
time: 0ms
memory: 7900kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #9:

score: 0
Accepted
time: 2ms
memory: 5616kb

input:

1 1
1

output:

1
0 0 4

result:

ok Kout = 1, Kans = 1

Test #10:

score: 0
Accepted
time: 2ms
memory: 5612kb

input:

1 1
0

output:

1
0 0 1

result:

ok Kout = 1, Kans = 1

Test #11:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #12:

score: 0
Accepted
time: 2ms
memory: 5856kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #13:

score: 0
Accepted
time: 0ms
memory: 7656kb

input:

2 4
0111
0010

output:

15
0 0 1
0 1 1
0 2 1
0 3 1
0 1 3
0 2 3
0 3 3
1 2 3
1 3 3
1 3 2
2 3 2
0 2 4
1 2 4
2 2 4
2 3 4

result:

ok Kout = 15, Kans = 15

Test #14:

score: 0
Accepted
time: 2ms
memory: 5708kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #15:

score: -100
Wrong Answer
time: 2ms
memory: 7616kb

input:

4 2
10
11
01
00

output:

-1

result:

wrong answer Jury has a solution while the participant doesn't, Kans = 0