err0r's blog

By err0r, history, 8 months ago, In English,

i have solved two similar problem recently 1027F & 875F

To solve 1027F i tried approach this problem using binary search and dsu but i am getting tle but my straightforward solution using kuhn`s algorithm got AC.

Can anyone explain the reason behind it? why kuhn`s is so fast here and why my dsu with binary search got TLE.

links to my submission

DSU kuhn

and to makes things more complicated for me

875F i tried this problem using kuhn got tle but i got AC using DSU.

links to my submission

DSU kuhn

it will be very helpful if anyone can explain this to me!! when and where should i use DSU or kuhn!!

kind regards

Read more »

 
 
 
 

By err0r, history, 10 months ago, In English,

these are the problems i solved so far!

1 2 3

*any other suggestions/advice related to flow will be very helpful!!
(specially how to approach them as i find it very difficult)

Read more »

 
 
 
 
  • Vote: I like it  
  • +16
  • Vote: I do not like it  

By err0r, history, 11 months ago, In English,
 
 
 
 
  • Vote: I like it  
  • +3
  • Vote: I do not like it  

By err0r, history, 11 months ago, In English,

Recently i learnt Aho-Corasick Algorithm for Pattern Searching. To find all occurrences of pattern strings in text string. i store all possible output links in my prefix tree(trie)

But case such as
text = aaaaa
pattern = {a, aa, aaa, aaaa, aaaaa}
will give me huge number of output link!

my implementation is there a better way to store them?

Read more »

 
 
 
 
  • Vote: I like it  
  • +8
  • Vote: I do not like it