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

23369번 - Fridge Distraction 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB125777167.619%

문제

Kevin has an excellent organisation system for his refrigerator: everything is arranged on one long shelf. At the moment, every item is organised in alphabetical order from "a" at the front to "z" at the back.

When Kevin wants to get some item from the refrigerator, he simply pulls out everything in front of it, takes the item out, places all the other items back in their original order, and finally places the used item at the front when he is done. This takes a number of seconds equal to the total number of items taken out of the fridge.

You are planning a surprise birthday party for Kevin in which you and his other friends bought him a normal fridge. You will need to keep him busy for exactly the right amount of time -- and you will do this by repeatedly asking him to take items out of the fridge.

Given the amount of time you need to waste, in seconds, suggest an order of as little items as possible to be taken out, such that Kevin will take exactly this long.

입력

The input consists of:

  • One line containing $n$ (1ドル \leq n \leq 26$), the number of items in the refrigerator, and $t$ (1ドル \leq t \leq 10000$), the number of seconds you need to waste.

출력

Output the smallest possible number of items you should ask Kevin to take out of the fridge.

Next output one line containing, in order, the letters of all the items you will ask Kevin to take out of the fridge.

If there are multiple valid solutions, you may output any one of them.

제한

예제 입력 1

4 7

예제 출력 1

2
c d

예제 입력 2

3 10

예제 출력 2

4
b a c b

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2021 Preliminaries F번

  • 문제를 만든 사람: Robin Lee
(追記) (追記ここまで)

출처

대학교 대회

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

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