QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#254429 | #2521. Keystroke | tpc_icpc_n# | AC ✓ | 0ms | 3588kb | C++20 | 647b | 2023-11-18 12:31:04 | 2023-11-18 12:31:06 |
Judging History
answer
#include <iostream>
#include <vector>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
void solve() {
int m,n; cin >> m >> n;
set<int> R,C;
rep(i,m){
int a; cin >> a; R.insert(a);
}
rep(i,n){
int a; cin >> a; C.insert(a);
}
int ans = 0;
rep(i,1<<4){
set<int> r,c;
rep(j,4){
if((i>>j)&1){
r.insert(j/2);
c.insert(j%2);
}
}
if(r==R && c==C) ans++;
}
cout << ans << '\n';
}
int main() {
int T;
std::cin >> T;
while(T--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
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: 3588kb
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: 3560kb
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