arp95's blog

By arp95, history, 11 years ago, In English
  • Vote: I like it
  • +6
  • Vote: I do not like it

»
11 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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

»
11 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 .

  • »
    »
    11 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    smallest character present ahead of it using segment trees

    What is map<>: the post.