Coder-Strike 2014 - Finals (online edition, Div. 2) A. Pasha and Hamsters

OpenSoucre發表於2014-04-22

水題

#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;
}

 

相關文章