QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#604850#2521. Keystrokeucup-team3474AC ✓1ms7700kbC++20848b2024-10-02 14:14:292024-10-02 14:14:30

Judging History

你现在查看的是最新测评结果

  • [2024-10-02 14:14:30]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:7700kb
  • [2024-10-02 14:14:29]
  • 提交

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