QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#721342 | #2521. Keystroke | ucup-team5062# | AC ✓ | 1ms | 3832kb | C++17 | 649b | 2024-11-07 15:53:53 | 2024-11-07 15:53:55 |
Judging History
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