Advertisement
Guest User

MITH UUUUUUUUUUUU MY HEROOOO xD

a guest
Jan 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5.  
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     #ifndef ONLINE_JUDGE
  12.     freopen("input.txt", "r", stdin);
  13.     freopen("output.txt", "w", stdout);
  14.     #endif
  15.  
  16.     ios::sync_with_stdio(0);
  17.     cin.tie(0); cout.tie(0);
  18.  
  19.  
  20.  
  21.     vector <long long> v;
  22.     v.clear();
  23.     long long n;
  24.     cin >> n;
  25.     long long a;
  26.     for(long long i=0; i<n; i++)
  27.             {
  28.                 cin >> a;
  29.                 v.push_back(a);
  30.             }
  31.  
  32.     vector<long long>::iterator it,it1 = v.begin();
  33.     long long erased;
  34.     for(long long i=0; i<n; i++)
  35.             {
  36.                 cin >> a;
  37.                 erased = 0;
  38.                 it = find(it1, v.end(), a);
  39.                 if(it != v.end()) erased = it - it1 + 1, it1 = it+1;
  40.                 cout << erased << ' ';
  41.             }
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement