题解:P11445 「ALFR Round 3」A 调皮的学生

· · 题解

开个桶记录下每个学生给几个老师投票,最后再扫一遍记录下答案即可。

#include<bits/stdc++.h>
using namespace std;
const int N=105;
int a[N];
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n;cin>>n;
    for(int i=1;i<=3;i++){
        int x;cin>>x;
        while(x--){
            int y;cin>>y;
            a[y]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)if(a[i]!=1)ans++;
    cout<<ans;
    return 0;
}