Good day everyone,
Today I was solving 731C - Носки and I was getting TLE on test 32.
I really have no idea what is causing the TLE can somebody please help me ?
Note: that in my submission my code gave an answer but still it was counted as TLE.
My submission: 22259984.
Thank you for reading.
:)
Use a map to store count instead of an array . That's what causes tle .
Shouldn't maps have a log(n) complexity to access a value and shouldn't the array's complexity be (1) ?
memset(countt, 0, sizeof(countt));
works in O(n). Try to use map for counting and clear it after each dfs.Ahhh so that's why...thank you guys so much you are awesome.
:)