QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#528153 | #2521. Keystroke | NYCU_CartesianTree# | AC ✓ | 0ms | 3668kb | C++14 | 875b | 2024-08-23 10:38:41 | 2024-08-23 10:38:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int cnt[1 << 2][1 << 2];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
for(int i = 0; i < (1 << 4); i++){
int typex = 0, typey = 0;
for(int j = 0; j < 4; j++){
if(i & (1 << j)){
int x = j / 2;
int y = j % 2;
typex |= (1 << x);
typey |= (1 << y);
}
}
cnt[typex][typey]++;
}
int t;
cin >> t;
while(t--){
int n, m;
cin >> n >> m;
int typex = 0, typey = 0;
int in;
for(int i = 0; i < n; i++){
cin >> in;
typex |= (1 << in);
}
for(int i = 0; i < m; i++){
cin >> in;
typey |= (1 << in);
}
cout << cnt[typex][typey] <<'\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
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: 3668kb
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: 3636kb
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