#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N; cin >> N;
vector<int>v(N);
for (int i = 0; i < N; i++) {
cin >> v[i];
}
bool flag = prev_permutation(v.begin(), v.end());
if (!flag) cout << -1;
else {
for (int i : v) {
cout << i << ' ';
}
}
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 10988๋ฒ - ํฐ๋ฆฐ๋๋กญ์ธ์ง ํ์ธํ๊ธฐ (0) | 2021.10.26 |
---|---|
[๋ฐฑ์ค,c++] 10987๋ฒ - ๋ชจ์์ ๊ฐ์ (0) | 2021.10.26 |
[๋ฐฑ์ค,c++] 10974๋ฒ - ๋ชจ๋ ์์ด (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10972๋ฒ - ๋ค์ ์์ด (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10953๋ฒ - A+B-6 (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10951๋ฒ - A+B-4 (0) | 2021.10.25 |
๋๊ธ