Can someone help me with this problem .
https://www.hackerearth.com/october-clash-15/algorithm/kevin-doesnt-like-his-string/
My soln : ( got 79 points ) http://ideone.com/rysX90
| # | User | Rating |
|---|---|---|
| 1 | Kevin114514 | 3722 |
| 2 | Benq | 3676 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3196 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | maroonrk | 153 |
| 2 | Qingyu | 152 |
| 3 | nik_exists | 151 |
| 4 | AmShZ | 147 |
| 4 | maspy | 147 |
| 6 | Um_nik | 144 |
| 7 | Errichto | 139 |
| 8 | adamant | 135 |
| 9 | BledDest | 134 |
| 10 | AksLolCoding | 132 |
Can someone help me with this problem .
https://www.hackerearth.com/october-clash-15/algorithm/kevin-doesnt-like-his-string/
My soln : ( got 79 points ) http://ideone.com/rysX90
| Name |
|---|



Think greedy with map<>s/set<>s instead of segment trees.
What i did was as follows : for each index i looked for the smallest character present ahead of it using segment trees . Now as we had restriction for the number of vertices to be cut i took a visited array and greedily found the smallest character for each character from the starting and marked them visited. Now if at any moment the number of cut vertices left are 1 and the smallest character for that index ( both are unvisiited ) then i used another segment tree of marked vertices to take care of this condition . In the end i sorted all the cut vertices characters to get the lexicographical smallest .
What is map<>: the post.