MY MEMO

[BAEKJOON] 10973 이전 순열 본문

ALGORITHM/BAEKJOON

[BAEKJOON] 10973 이전 순열

l_j_yeon 2017. 10. 5. 15:09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n,input;
    scanf("%d", &n);
    vector<int>DP(n);
     
    for (int j = 0; j < n; j++) scanf("%d", &DP[j]);
 
    if (prev_permutation(DP.begin(), DP.end()))
        for (int j = 0; j < n; j++)printf("%d ", DP[j]);
    else printf("-1");
 
    return 0;
}


'ALGORITHM > BAEKJOON' 카테고리의 다른 글

[BAEKJOON 1822 차집합 (실패)  (0) 2017.10.05
[BAEKJOON] 10868 최소값  (0) 2017.10.05
[BAEKJOON] 10974 모든 순열  (0) 2017.10.05
[BAEKJOON] 2169 로봇 조종하기  (0) 2017.10.05
[BAEKJOON] 1495 기타리스트  (0) 2017.10.05