QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#604850 | #2521. Keystroke | ucup-team3474 | AC ✓ | 1ms | 7700kb | C++20 | 848b | 2024-10-02 14:14:29 | 2024-10-02 14:14:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m,k;
ll a[N],b[N];
char s[N];
map<pair<set<int>,set<int>>,int> mp;
void __(){
cin>>n>>m;
set<int> se1,se2;
for(int i=1;i<=n;i++){
cin>>a[i];
se1.insert(a[i]);
}
for(int i=1;i<=m;i++){
cin>>b[i];
se2.insert(b[i]);
}
cout<<mp[{se1,se2}]<<endl;
}
int main(){
for(int i=0;i<16;i++){
set<int> se1,se2;
for(int j=0;j<4;j++){
if((i>>j)&1){
int r=j/2,c=j%2;
se1.insert(r);
se2.insert(c);
}
}
pair<set<int>,set<int>> k={se1,se2};
mp[k]++;
}
int _=1;
cin>>_;
while(_--){
__();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5664kb
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: 1ms
memory: 7700kb
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: 1ms
memory: 7672kb
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