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

16103번 - Drawn and Quartered 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB24815013359.111%

문제

You are playing a game which involves drawing and redrawing a string on a blackboard. You start with a string S of length N and perform a switcheroo on the string exactly K times. A switcheroo involves breaking S into quarters, and then moving the middle two quarters to the end of S without changing their relative order to each other. For example, say you start with aabbccdd. After a single switcheroo, the string would become aaddbbcc. After another switcheroo, you would have aaccddbb, and so on.

Given some starting string S and the number of times you should perform a switcheroo, what is the final state of the string?

입력

The input starts with a line containing two integers N (4 ≤ N ≤ 100 000), which is the length of the string, and K (1 ≤ K ≤ 1018), which is the number of times you should perform a switcheroo to S. It is guaranteed that N is a multiple of 4.

The second line contains S. The string S contains only lowercase letters and consists of exactly N characters.

출력

Display the string after performing K switcheroos.

제한

예제 입력 1

4 2
abcd

예제 출력 1

acdb

예제 입력 2

8 1
abcdefgh

예제 출력 2

abghcdef

예제 입력 3

20 26
southpacificregional

예제 출력 3

southicregionalpacif

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > 2017 ACM South Pacific Programming Contest D번

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

출처

대학교 대회

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

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