|
|
back to boardwhat is test 22? tle at test 22... Re: what is test 22? Just some big test, probably without any 1's in the answer. To speed up your code, don't use stl structures - write your own hash. Re: what is test 22? i have written my own hash to store m internal conflict and then check all n days.but also got tle. It is driving me mad! Do you have some better solutions? thx for help me. Edited by author 24.03.2011 16:11 Edited by author 24.03.2011 16:15 Re: what is test 22? No, my solution is pretty straightforward - take every day and for all i from 1 to 50 check whether triple (a[n], a[i+n], i) occurs in the sequence that was read from the input. Overall complexity is O(50*n) assuming complexity of your hash is O(1) Edited by author 24.03.2011 16:22 Re: what is test 22? I want know how to hash triple(ai,bi,di)..i use a list hash[len][ai] and scan it.I think it is the reason i got tle... Re: what is test 22? still tle or wa... Re: what is test 22? Posted by svr 26 Mar 2011 13:06 AC with STL Hashing is somthing terrible. 1)form all possible segments ;2) sort it 3) find all belongings for each given conflict; 3) apply segment union - O(n) algo(very important! classical!) |
|
|