QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#301898#7951. Magic Cardsmariowong#WA 1ms3808kbC++17878b2024-01-10 14:00:512024-01-10 14:00:51

Judging History

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

  • [2024-01-10 14:00:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3808kb
  • [2024-01-10 14:00:51]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n,k,m,f;
	cin >> n >> k >> m >> f;
	vector <pair<long long,long long>  > a(n+1);
	for (int i=0;i<k;i++){
		long long v;
		if (i >= 50) v=(1<<(i-50));
		else v=(1<<i);
		for (int j=1;j<=m;j++){
			int x;
			cin >> x;
			if (i >= 50) a[x].second=(a[x].second|v);
			else a[x].first=(a[x].first|v);
		}
	}
	map <pair<long long,long long>,int> cnt;
	map <pair<long long,long long>,int> val;
	for (int i=1;i<=n;i++) cnt[a[i]]++,val[a[i]]=i;
	for (int i=1;i<=f;i++){
		string s;
		cin >> s;
		pair <long long,long> x;
		for (int j=0;j<k;j++){
			if (s[j] == 'Y'){
				if (j >= 50) x.second+=(1<<(j-50));
				else x.first+=(1<<j);
			}
		}
		
		if (cnt[x] != 1) cout << "0\n";
		else cout << val[x] << "\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3808kb

input:

12 4 6 3
1 9 7 11 3 5
2 10 3 6 7 11
4 5 6 7 6 12
8 11 10 9 12 9
YYNY
NNNY
YNNN

output:

11
8
1

result:

ok 3 lines

Test #2:

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

input:

13 4 6 4
1 9 7 11 3 5
2 10 3 6 7 11
4 5 6 7 6 12
8 11 10 9 12 9
YYNY
NNNY
YNNN
NNNN

output:

11
8
1
13

result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

14 4 6 4
1 9 7 11 3 5
2 10 3 6 7 11
4 5 6 7 6 12
8 11 10 9 12 9
YYNY
NNNY
YNNN
NNNN

output:

11
8
1
0

result:

ok 4 lines

Test #4:

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

input:

1 1 1 1
1
Y

output:

1

result:

ok single line: '1'

Test #5:

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

input:

1 100 1 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY...

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'