fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4. int a; cin>>a;
  5. vector<int>b(a);
  6. for(int&i:b)cin>>i;
  7. stack<pair<int,int>>s;
  8. for(int i=0;i<a;i++)s.push({b[i],i+1});
  9. vector<pair<int,int>>c;
  10. while(!s.empty()){c.push_back(s.top());s.pop();}
  11. sort(c.begin(),c.end());
  12. for(auto&i:c)cout<<i.second<<" ";
  13. }
  14.  
Success #stdin #stdout 0.01s 5284KB
stdin
5
9 14 2 5 6
stdout
3 4 5 1 2