Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int Q, N, aux;
- map<int,int> position;
- set<int> exists;
- int main(){
- cin.tie(0);
- ios::sync_with_stdio(0);
- cin>>Q>>N;
- for(int i = 0; i<Q;i++){
- cin>>aux;
- exists.insert(aux);
- if(i != 0){
- if(position[aux]==0){
- position[aux] = i;
- }
- }
- }
- for(int i = 0; i<N;i++){
- cin>>aux;
- if(exists.count(aux)){
- cout<<position[aux]<<"\n";
- }else{
- cout<<"-1\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement