QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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(_--){
__();
}
}
详细
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