Advertisement
Josif_tepe

Untitled

Feb 26th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     pair<int, int> p[n];
  10.     for(int i = 0; i < n; i++) {
  11.         cin >> p[i].first;
  12.         p[i].second = i;
  13.     }
  14.     sort(p, p + n);
  15.     for(int i = 0; i < n; i++) {
  16.         cout << p[i].first << " " << p[i].second << endl;
  17.     }
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement