Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- ios::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- vector <long long> v;
- v.clear();
- long long n;
- cin >> n;
- long long a;
- for(long long i=0; i<n; i++)
- {
- cin >> a;
- v.push_back(a);
- }
- vector<long long>::iterator it,it1 = v.begin();
- long long erased;
- for(long long i=0; i<n; i++)
- {
- cin >> a;
- erased = 0;
- it = find(it1, v.end(), a);
- if(it != v.end()) erased = it - it1 + 1, it1 = it+1;
- cout << erased << ' ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement