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

11707번 - Card Game Strategy 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB165457.143%

문제

Alice and Bob are going to play a card game. There are n cards, each having an integer written on it. The game proceeds as follows:

  1. Alice chooses an integer between a and b, inclusive. Call this integer t. Alice then tells Bob the value of t.
  2. Bob chooses k out of the n cards. Compute the sum of the integers written on the k cards Bob chooses. Call this sum u.

Alice’s objective is to make |t − u| as large as possible and Bob’s is to make |t − u| as small as possible.

Prior to the game, both Alice and Bob know the values of n, k, a, and b, and also the integers on the cards. Both Alice and Bob will play optimally. In particular, Alice will make a choice, knowing that Bob will surely minimize |t − u| for told t. Additionally, assume that Alice prefers to choose smaller t if she has multiple equally good choices.

Your task is to determine the outcome of the game: the value of t Alice will choose and the k cards Bob will choose for that t.

입력

The input consists of two lines representing a single test case. The first line contains four integers n, k, a, and b (1 ≤ k ≤ n ≤ 600, 0 ≤ a ≤ b ≤ 180,000). The second line contains n integers x1, . . . , xn (0 ≤ xi ≤ 300), denoting that xi is written on the i-th card.

출력

Display two lines: The first line should contain an integer representing the value of t Alice will choose. The second line should contain k distinct integers between 1 and n, inclusive, representing the indices of the cards Bob will choose. If Bob has multiple equally good choices, display any one of them.

제한

예제 입력 1

4 2 58 100
10 10 50 80

예제 출력 1

75
2 3

예제 입력 2

8 3 1300 1800
2 0 1 5 0 4 1 9

예제 출력 2

1800
4 6 8

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Spring Contest > JAG Spring Contest 2015 B번

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

출처

대학교 대회

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

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