水题
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,a,b; cin >> n >>a >> b; vector<int> apple(n+1,0); int k; for(int i = 0 ; i < a; ++ i) { cin>>k; apple[k] = 1; } for(int i = 0 ; i < b; ++ i) { cin >> k; if(apple[k]==0) apple[k] = 2; } for(int i = 1 ; i < n+1; ++ i){ if( i == 1) cout<< apple[i]; else cout<<" "<<apple[i]; } cout<<endl; }