| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 174 | 72 | 58 | 37.179% |
In the year 3025, ICPC (Interplanetary Constitution for Peculiar Creatures) found an exotic animal in asteroid KP-124. Upon further inspection, ICPC succeeded in figuring out how they live and how their ecosystem works altogether:
The researchers on KP-124 quickly became fascinated by these creatures and kept $n$ of those as pets in the research station to amuse themselves from time to time. Let us give them a unique id from 1ドル$ to $n$. The mission on KP-124 was a success with the pets’ emotional support and it was time for the researchers to leave the asteroid. As a farewell present to the pets, you, one of the researchers, decided to press buttons a total of $X$ times. To ensure an even chance of survival among the creatures, you made a rule to press the button on one that has the smallest number on its head each time. If there is a tie, you choose the one having the smallest id among those tied.
| Creature id | Initial number | Increment |
|---|---|---|
| 1ドル$ | 5ドル$ | 3ドル$ |
| 2ドル$ | 1ドル$ | 4ドル$ |
| 3ドル$ | 3ドル$ | 6ドル$ |
For example, let $n = 3,ドル $X = 3,ドル and the information of the 3ドル$ pets be as the table above. Initially they have the numbers $[5, 1, 3]$. On the first press, you will press the button on creature 2ドル,ドル since it has the smallest number. Now the numbers become $[5, 5, 3],ドル so that the smallest will be creature 3ドル$ and you will press its button. Then the numbers become $[5, 5, 9]$ where the smallest one is tied between creature 1ドル$ and 2ドル$. Since creature 1ドル$ has the smallest id, you will press the button on creature 1ドル,ドル making the numbers on them $[8, 5, 9]$.
Given the information about the creatures before pressing their buttons, write a program to find the resulting numbers on the creatures’ heads.
Your program is to read from standard input. The input starts with a line containing two integers, $n$ and $X$ (1ドル ≤ n ≤ 500,000円$; 1ドル ≤ X ≤ 10^{12}$), where $n$ and $X$ are as explained above. The second line contains $n$ nonnegative integers, $i$-th of which is the number initially written on the head of creature $i$. The third line contains $n$ positive integers, $i$-th of which is how much the value on creature $i$ is increased by when its button is pressed. All the integers on the second and the third lines are no more than 10ドル^6$.
Your program is to write to standard output. Print exactly one line. The line should contain $n$ integers, $i$-th of which is the number written on the head of creature $i$ after buttons are pressed $X$ times in total.
3 3 11 1 22 14 5 1
25 11 22
9 5 9 8 6 2 1 6 5 10 9 9 3 9 1 1 4 10 5 3
9 8 6 4 4 6 5 10 9
ICPC > Regionals > Asia Pacific > Korea > 2025 ICPC Asia Seoul Regional G번