Блог пользователя arp95

Автор arp95, история, 11 лет назад, По-английски
  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Think greedy with map<>s/set<>s instead of segment trees.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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 .