TLE for FIND DUPLICATES!

solution link
I used segment tree for this question but I am getting tle please help me out or I shall move on to BIT or fenwick tree

I also used policy based data structures and again got TLE solution link.
solution link

rectified myself fast IO were the issues. with my policy based data structures approach but still not getting why segment tree gave TLE.

correct solution link
solution

Using 26 segment trees , right ? I guess most of the people didn’t use segment tree, though my only idea was segment tree.

ya brother but policy based data structures were enough for this question my second soluton passed

1 Like

Can anybody give a test-case where my solution fails for this one:- CodeChef: Practical coding for everyone

sorry I couldn;t because I only saw find duplicates and hurdled with the TLE for last 1 hour

1 Like

Instead of making it [N][26], make every node a set of characters and check.

And even with the given size, should it get a TLE?

I made every node an array of 26 characters…It worked quite fine.

https://www.codechef.com/viewsolution/29285824

1
3 3
1 1 1
1 1 1
1 1 1
aaa
zzz
aaa

1 Like

Instead of keeping each node as a 26 character array, maybe you could use bitmasks here?