PivotOJ

Concurrent Contests

시간 제한: 4000ms메모리 제한: 1024MB출처: BAPC 2024BOJ 32597

문제

Because of some scheduling issues, there are mm different programming contests scheduled on the same day, at the same time. There are nn 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 tt, then the winning probability in this contest of a participant with skill level ss is st\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 nn and mm (1n21051\leq n\leq 2\cdot10^5, 1m1001 \leq m \leq 100), the number of contestants and the number of contests.
  • One line with nn integers ss (1s1091\leq s\leq10^9), the skill levels of the contestants.
  • One line with mm integers pp (1p1091 \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 11-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
출력
4 4 2 6 1
1 5
1 3

예제 2

입력
3 2
9 10 8
10 100
출력
0
3 2 3 1
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.