QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#762003 | #2521. Keystroke | SanguineChameleon# | AC ✓ | 1ms | 3704kb | C++20 | 1.0kb | 2024-11-19 12:21:49 | 2024-11-19 12:21:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void justDoIt();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
justDoIt();
return 0;
}
void test() {
int n, m;
cin >> n >> m;
int row = 0;
int col = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
row |= (1 << x);
}
for (int i = 0; i < m; i++) {
int x;
cin >> x;
col |= (1 << x);
}
int res = 0;
for (int mask = 0; mask < 16; mask++) {
int row2 = 0;
int col2 = 0;
for (int i = 0; i < 4; i++) {
if ((mask >> i) & 1) {
int r = (i >> 1);
int c = (i & 1);
row2 |= (1 << r);
col2 |= (1 << c);
}
}
if (row == row2 && col == col2) {
res++;
}
}
cout << res << '\n';
}
void justDoIt() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
test();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3660kb
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: 3704kb
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: 3588kb
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