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

31957번 - Not Another Constructive! 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB (추가 메모리 없음)123524039.216%

문제

Sick of solving geometry problems, you decide to solve the following constructive problem: find a string of length $n$ that contains exactly $k$ not necessarily contiguous subsequences of NAC.

This problem seems too familiar though. Here's the twist - your friend has given you part of the string, so you must fill in the remaining characters!

입력

The first line of input contains two integers $n$ (1ドル \le n \le 40$) and $k$ (0ドル \le k \le 2,500円$), where $n$ is the length of the string and $k$ is the number of not necessarily contiguous subsequences of NAC that the output must contain.

The second line contains a string of length exactly $n,ドル consisting only of uppercase letters and/or question marks.

출력

Output a string of upper case letters, replacing each question mark in the input string with an uppercase letter so that the resulting string has exactly $k$ subsequences of NAC. If this is not possible, output -1. Any uppercase letters in the input string must be kept in their position. There may be multiple possible solutions for any given test case; any correct solution will be accepted.

제한

예제 입력 1

22 2
N??A??????C???????????

예제 출력 1

NOTANOTHERCONSTRUCTIVE

예제 입력 2

18 0
COUNTINGSATELLITES

예제 출력 2

COUNTINGSATELLITES

예제 입력 3

2 1
??

예제 출력 3

-1

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2024 I번

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

출처

대학교 대회

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

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