Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define Nmax 200001
- using namespace std;
- int n,a[Nmax],F[Nmax],x;
- int main()
- {
- cin>>n;
- int i;
- for(i=1;i<=n;++i)
- cin>>a[i];
- i=1;
- int nrzero=n;
- while(i<=n)
- {
- cin>>x;
- int sol=0;
- while(!F[x])
- if(x!=a[i])
- F[a[i++]]=1,++sol;
- else
- ++i,++sol,F[x]=1;
- --nrzero,cout<<sol<<' ';
- }
- for(i=1;i<=nrzero;++i)
- cout<<0<<' ';
- cout<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement