fork download
  1. /*{{{*/
  2. #include <vector>
  3. #include <iostream>
  4. #define rep(Start,start,end) for(int Start=start;Start<end;Start++)
  5. #define pb push_back
  6. using namespace std;
  7.  
  8. /*}}}*/
  9.  
  10. int main() {
  11. int n,tmp;
  12. vector<int>lst;
  13.  
  14. cin>>n;
  15. rep(x,0,n) {
  16. cin>>tmp;
  17. lst.pb(tmp);
  18. }
  19.  
  20. int m;
  21. cin>>m;
  22. vector<int>::iterator it;
  23.  
  24. rep(x,0,m) {
  25. cin>>tmp; tmp--;
  26. it=lst.begin()+tmp;
  27.  
  28. cout<<*(it)<<"\n";
  29. lst.erase(it);
  30. }
  31.  
  32.  
  33.  
  34. return 0;}
Success #stdin #stdout 0s 3476KB
stdin
5
26 1 42 15 3 
2
3
4
stdout
42
3