QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#727704 | #2521. Keystroke | ucup-team5226# | AC ✓ | 0ms | 3592kb | C++20 | 1018b | 2024-11-09 13:36:07 | 2024-11-09 13:36:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using sl = set<ll>;
#define rep3(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define rep2(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
void solve() {
ll m, n;
cin >> m >> n;
vl a(m), b(n);
for (ll& x : a) cin >> x;
for (ll& x : b) cin >> x;
ll ans = 0;
rep2(i, 1, 1 << 4) {
sl p, q;
if (i & (1 << 0)) {
p.insert(0);
q.insert(0);
}
if (i & (1 << 1)) {
p.insert(1);
q.insert(0);
}
if (i & (1 << 2)) {
p.insert(0);
q.insert(1);
}
if (i & (1 << 3)) {
p.insert(1);
q.insert(1);
}
if (vl(all(p)) == a and vl(all(q)) == b) {
ans++;
}
}
cout << ans << endl;
}
int main() {
ll t;
cin >> t;
rep2(_, 0, t) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
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: 3592kb
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: 3584kb
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