AT_ahc053_a [AHC053A] Random Sum Game
Description
There are $ N $ blank cards, and a random number generator that generates $ M $ integers between $ L $ and $ U $ , inclusive, independently and uniformly at random.
Using these items, you play the following game.
1. First you choose arbitrary integers $ A_1, \dots, A_N $ between $ 1 $ and $ U $ , inclusive, and write $ A_i $ on $ i $ -th card.
2. Then, using the random number generator, $ M $ integers $ B_1, \dots, B_M $ are generated.
3. You may discard any number of cards (possibly zero), and partition the remaining cards into $ M $ piles (possibly empty).
The objective of this game is to make the sum of the integers written on cards in $ j $ -th pile as close to $ B_j $ as possible.
### Input & Output Format
First, $ N, M, L, U $ are given from Standard Input.
> $ N $ $ M $ $ L $ $ U $
Let $ A_i $ be the integer you write on $ i $ -th card. Then output to Standard Output as follows.
> $ A_1 $ $ A_2 $ $ \dots $ $ A_N $
Then $ B_1, \dots, B_M $ are given from Standard Input. (Notice that you have to output $ A_1, \dots, A_N $ before reading $ B_1, \dots, B_M $ .)
> $ B_1 $ $ B_2 $ $ \dots $ $ B_M $
Let $ X_i = 0 $ if you decided to discard $ i $ -th card, and otherwise let $ X_i $ be the index of the pile to which $ i $ -th card belongs. Then output to Standard Output as follows.
> $ X_1 $ $ X_2 $ $ \dots $ $ X_N $
**All the output must be followed by a new line, and you have to flush Standard Output.** Otherwise, the submission might be judged as TLE.
[Show example](https://img.atcoder.jp/ahc053/Q405bDmv.html?lang=en&seed=0&output=sample)
Input Format
N/A
Output Format
N/A
Explanation/Hint
### Scoring
Let $ S_j $ be the sum of the integers written on cards in $ j $ -th pile, and define the error $ E $ by $ E = \sum_{j = 1}^M |S_j - B_j| $ . Then your score is $ \mathrm{round}((20 - \log_{10}(1 + E)) \times 5 \times 10^7) $ .
There are $ 150 $ test cases, and the score of a submission is the total score for each test case. If your submission produces an illegal output or exceeds the time limit for some test cases, the submission itself will be judged as WA or TLE , and the score of the submission will be zero. The highest score obtained during the contest will determine the final ranking, and there will be no system test after the contest. If more than one participant gets the same score, they will be ranked in the same place regardless of the submission time.
### Input Generation
- $ N = 500, M = 50, L = 10^{15} - 2 \times 10^{12}, U = 10^{15} + 2 \times 10^{12} $
- Generate $ M $ integers between $ L $ and $ U $ , inclusive, independently and uniformly at random, and let $ B_1, \dots, B_M $ be the sequence obtained by sorting them in ascending order.
### Tools (Input generator and visualizer)
- [Web version](https://img.atcoder.jp/ahc053/Q405bDmv.html?lang=en): This is more powerful than the local version providing animations.
- [Local version](https://img.atcoder.jp/ahc053/Q405bDmv.zip): You need a compilation environment of [Rust language](https://www.rust-lang.org/).
- [Pre-compiled binary for Windows](https://img.atcoder.jp/ahc053/Q405bDmv_windows.zip): If you are not familiar with the Rust language environment, please use this instead.
Please be aware that sharing visualization results or discussing solutions/ideas during the contest is prohibited.