Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <utility>
- #include <algorithm>
- #include <iostream>
- using namespace std;
- int main()
- {
- const int N = 4;
- int input[] = { 4, 3, 2, 1 };
- vector< pair< int , int > > vec(N);
- for(int i = 0; i < N; ++i) { vec[i] = make_pair(input[i], i); }
- sort(vec.begin(), vec.end());
- for(int i = 0; i < N; ++i) { cout << vec[i].second; }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment