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

32597번 - Concurrent Contests 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB72363152.542%

문제

Because of some scheduling issues, there are $m$ different programming contests scheduled on the same day, at the same time. There are $n$ people who would like to participate in these contests, but because all contests happen simultaneously, each participant can only compete in one contest. Everyone wants to choose the contest in which to participate such that their expected winnings are maximized.

Every contest has a single cash prize for the winner (no-one else gets a prize). Furthermore, every participant has a skill level, which determines their winning probability. If the sum of skill levels over all participants in a contest is $t,ドル then the winning probability in this contest of a participant with skill level $s$ is $\frac{s}{t}$.

Find a distribution of the participants over the contests, such that it is impossible for any person to switch to a different contest and increase their expected winnings. It is guaranteed that such a distribution exists.

입력

The input consists of:

  • One line with two integers $n$ and $m$ (1ドル\leq n\leq 2\cdot10^5,ドル 1ドル \leq m \leq 100$), the number of contestants and the number of contests.
  • One line with $n$ integers $s$ (1ドル\leq s\leq10^9$), the skill levels of the contestants.
  • One line with $m$ integers $p$ (1ドル \leq p \leq 10^9$), the prizes for the winners of the contests.

The sum of all skill levels is at most \(10^9\).

출력

For each contest, output the number of contestants that should participate in this contest, followed by the 1ドル$-based indices of the contestants that should participate in this contest.

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

제한

예제 입력 1

6 3
2 5 10 3 7 1
100 50 75

예제 출력 1

4 4 2 6 1
1 5
1 3

예제 입력 2

3 2
9 10 8
10 100

예제 출력 2

0
3 2 3 1

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 C번

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

출처

대학교 대회

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

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