Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int N;
- scanf("%d", &N);
- vector<int> inp(N);
- for (int &x : inp) scanf("%d", &x);
- auto cp = inp;
- sort(cp.begin(), cp.end());
- for (int i = 0; i < N; i++) {
- int inx = lower_bound(cp.begin(), cp.end(), inp[i]) - cp.begin();
- printf("%d ", cp[(inx + 1) % N]);
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement