PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000034. Quái vật (Monsters)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Quái vật (Monsters)
Monsters
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are monsters with health . Repeated attacks deal damage according to the original process. Determine the order in which monsters die.
Input
The first line contains . The second line contains .
Output
Print the monster indices in death order.
Constraints
- .
- .
- for .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): Full constraints.
Examples
Input
3 3
1 2 3
Output
3 2 1
Explanation
The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.