Logo
(追記) (追記ここまで)

30486번 - Keen on Order 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 1024 MB107332227.160%

문제

Nloglonia is hosting a movie festival that spans N days. There are K distinct movies, and on each of the N days, one of them will be displayed. Each of the available movies might be displayed on multiple days or not displayed at all during the festival.

The festival schedule is given as an integer array V of size N, with 1 ≤ Vi ≤ K, indicating which movie will be shown on each day. Bob wants to watch all K movies, and he firmly believes that the order in which he watches them will significantly affect his experience. So now he wonders: is it true that for every order of the movies, he would be able to pick K days to visit the festival and watch those movies in that given order? More formally, is it true that every permutation of 1, 2, . . . , K is a subsequence of V ? If this is not the case, Bob also wants you to find some permutation (any one) that is not.

입력

The first line contains two integers N and K (1 ≤ N, K ≤ 300), indicating respectively the number of days the movie festival lasts and the number of movies available for display.

The second line contains N integers V1, V2, . . . , VN (1 ≤ Vi ≤ K for i = 1, 2, . . . , N), indicating that the movie Vi will be displayed on day i.

출력

Output a single line with K integers showing a permutation of 1, 2, . . . , K which is not a subsequence of V . If every permutation is a subsequence of V , output the character “*” (asterisk) instead.

제한

예제 입력 1

9 3
1 2 3 1 2 3 1 2 3

예제 출력 1

*

예제 입력 2

11 4
1 2 3 4 2 3 3 2 4 1 4

예제 출력 2

3 4 1 2

예제 입력 3

11 4
1 2 3 4 2 3 3 2 4 1 4

예제 출력 3

4 1 2 3

예제 입력 4

5 6
6 5 4 3 2

예제 출력 4

6 5 4 3 2 1

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2023 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /