Saleh127

codeforces 368B.cpp

Jun 9th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. #define pi acos(-1)
  7. #define yes printf("YES\n");
  8. #define no printf("NO\n");
  9. int main()
  10. {
  11. Faster
  12. int n,m,a[200000],c[200000],d,e,f,i,j,k,l;
  13. cin>>n>>m;
  14. for(i=1;i<=n;i++)
  15. {
  16. cin>>a[i];
  17. }
  18. set<int>x;
  19. for(i=n;i>=1;i--)
  20. {
  21. x.insert(a[i]);
  22. c[i]=x.size();
  23. }
  24. while(m--)
  25. {
  26. cin>>e;
  27. cout<<c[e]<<endl;
  28. }
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment