QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#796444#6380. LaLa and Divination Magicrookiefyq#WA 0ms3840kbC++141.1kb2024-12-01 18:44:022024-12-01 18:44:02

Judging History

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

  • [2024-12-01 18:44:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-12-01 18:44:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2333;
bitset<N> bt[N], at[N];
int n, m;
string st;
void solve(){
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> st;
		for(int j = 0; j < m; j++){
			if(st[j] == '1') bt[j].set(i);
			else at[j].set(i);
		}
	}
	bitset<N> b[5];
	bool flag = 1;
	vector<array<int, 3>> ans;
	for(int i = 0; i < m; i++){
		if(bt[i].count() == n) ans.push_back({i, i, 4});
		else if(at[i].count() == n) ans.push_back({i, i, 1});
		for(int j = i + 1; j < m; j++){
			b[1] = at[i] | at[j];
			b[4] = bt[i] | bt[j];
			b[2] = bt[i] | at[j];
			b[3] = at[i] | bt[j];
			bool f = 0;
			for(int t = 1; t < 5; t++){
				if(b[t].count() == n){
					f = 1;
					ans.push_back({i, j, t});
				}
			}
			if(!f){
				flag = 0;
				break;
			}
		}
	}
	if(!flag) cout <<"-1\n";
	else {
		cout << ans.size() << '\n';
		for(auto[i, j, t] : ans){
			cout << i << " " << j << " " << t << '\n';
		}
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--) solve();
}

详细

Test #1:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #2:

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

input:

3 3
101
011
111

output:

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

result:

ok Kout = 6, Kans = 6

Test #3:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #4:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #5:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #6:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #7:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #8:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #9:

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

input:

1 1
1

output:

1
0 0 4

result:

ok Kout = 1, Kans = 1

Test #10:

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

input:

1 1
0

output:

1
0 0 1

result:

ok Kout = 1, Kans = 1

Test #11:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #12:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #13:

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

input:

2 4
0111
0010

output:

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

result:

ok Kout = 15, Kans = 15

Test #14:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #15:

score: -100
Wrong Answer
time: 0ms
memory: 3572kb

input:

4 2
10
11
01
00

output:

-1

result:

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