fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define fi first
  4. #define se second
  5. using namespace std;
  6. vector<pair<ll,ll>> v;
  7. const ll N=1e5+2;
  8. ll a[N];
  9. int main() {
  10. // ()
  11. // your code goes here
  12. ll n,i;
  13. cin>>n;
  14. for(i=1;i<=n;i++)
  15. {
  16. cin>>a[i];
  17. v.push_back({a[i],i});
  18. }
  19. sort(v.begin(),v.end());
  20. for(auto p:v)
  21. cout<<p.fi<<" "<<p.se<<"\n";
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5404KB
stdin
4
5
3
1
6
stdout
1 3
3 2
5 1
6 4