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

15440번 - Vera And LCS 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB83363457.627%

문제

Vera is learning about the longest common subsequence problem.

A string is a (possibly empty) sequence of lowercase letters. A subsequence of a string S is a string obtained by deleting some letters of S (possibly none or all). For example “vra”, “a”, “”, and “vera” are all subsequences of “vera”. The longest common subsequence (LCS) of two strings, A and B, is a string that is a subsequence of both A and B that has the maximum length among all strings that are a subsequence of both A and B. There could be multiple LCS for two given strings. For example a LCS of “vera” and “eats” is “ea”.

For homework she was given two strings A and B, both of length N and she had to determine the length of the LCS of A and B. She determined the answer to be K but lost B. Given A and K, help her find a possible value of B. It is possible that Vera may have made a mistake and no such B exists, in that case output “WRONGANSWER"(without quotes).

입력

The input will be in the format:

N K
A

Constraints:

  • 1 ≤ N ≤ 2000
  • 0 ≤ K ≤ 2000
  • N, K are integers
  • A consists of N lowercase letters

출력

Output one line consisting of the string B of N lowercase letters, or “W RONGANSW ER” if no B is valid. If there are multiple correct B output any of them.

제한

예제 입력 1

4 2
vera

예제 출력 1

eats

예제 입력 2

4 5
vera

예제 출력 2

WRONGANSWER

힌트

For the first example, another possible answer is “uber”.

출처

Contest > Waterloo's local Programming Contests > 4 March, 2017 B번

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

출처

대학교 대회

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

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