report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Delete numbers - MarisaOJ: Marisa Online Judge

Delete numbers

Time limit: 1500 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers indexed $0,1,...,n-1$. You will perform the following operation $n$ times: - Delete the maximum elements among elements with indices $0, k, 2 \times k,...$, if there are multiple maximum elements, delete the one with the smallest index. Find the deleted element at each step. ### Input - The first line contains 2 integers $n, k$. - The second line contains $n$ integers $A_i$. ### Output - Print the deleted element after each step. ### Constraints - $1 \le k \le n \le 10^5$. - $1 \le A_i \le n$. ### Example Input: ``` 10 3 2 3 1 9 10 4 5 6 1 5 ``` Output: ``` 9 10 4 5 6 2 5 3 1 1 ```
Square root decomposition
Frequency
Tree query
Inversions query
Nearest vertex
Dominating color
String occurences 3
Inversions query 2
Pair
Sparse update
Tree
Range query
String concatenation
Subarray distance
Chameleon
Knapsack
Bit counting
Subsequence queries
Sub-subsequence
Delete numbers
Mode
Marisa is happy
Inversions query 3
Upperbound
23 path
Yet another square root decomposition problem
Marisa plays poker
Wonderful world
Topic
Data structure
Rating 2200
Source HNOI
Solution (0) Solution