QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#721342#2521. Keystrokeucup-team5062#AC ✓1ms3832kbC++17649b2024-11-07 15:53:532024-11-07 15:53:55

Judging History

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

  • [2024-11-07 15:53:55]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3832kb
  • [2024-11-07 15:53:53]
  • 提交

answer

#include <set>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int T;
	cin >> T;
	for (int id = 1; id <= T; id++) {
		int N, M;
		cin >> N >> M;
		set<int> A, B;
		for (int i = 0; i < N; i++) {
			int x;
			cin >> x;
			A.insert(x);
		}
		for (int i = 0; i < M; i++) {
			int x;
			cin >> x;
			B.insert(x);
		}
		int ans = 0;
		for (int i = 0; i < 16; i++) {
			set<int> C, D;
			for (int j = 0; j < 4; j++) {
				if ((i >> j) & 1) {
					C.insert(j / 2);
					D.insert(j % 2);
				}
			}
			ans += int(A == C && B == D);
		}
		cout << ans << endl;
	}
	return 0;
}

详细

Test #1:

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

input:

2
2 1
0 1
0
1 2
1
0 1

output:

1
1

result:

ok 2 lines

Test #2:

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

input:

2
2 2
0 1
0 1
1 1
1
1

output:

7
1

result:

ok 2 lines

Test #3:

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

input:

9
1 1
0
0
1 1
0
1
1 1
1
0
1 1
1
1
1 2
0
0 1
1 2
1
0 1
2 1
0 1
0
2 1
0 1
1
2 2
0 1
0 1

output:

1
1
1
1
1
1
1
1
7

result:

ok 9 lines