#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 = next_permutation(v.begin(), v.end());
if (flag) {
for (int i : v) {
cout << i << ' ';
}
}
else cout << -1;
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 10987๋ฒ - ๋ชจ์์ ๊ฐ์ (0) | 2021.10.26 |
---|---|
[๋ฐฑ์ค,c++] 10974๋ฒ - ๋ชจ๋ ์์ด (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10973๋ฒ - ์ด์ ์์ด (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10953๋ฒ - A+B-6 (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10951๋ฒ - A+B-4 (0) | 2021.10.25 |
[๋ฐฑ์ค,c++] 10950๋ฒ - A+B-3 (0) | 2021.10.25 |
๋๊ธ