|
|
You may just want to continue the sequence from sample, for me it was enough to get it for n = 5 { 1, 3, 2, 6, 8, 4, 11, 5 } to start noticing the pattern. Alternatively, just plug it into OEIS and come across A019444 with an explanation how to compute the answer :D How you solved this problem with out many long surpluses? I had TLE 17 too, i solved this by making some tests and observing the rule I had found O(n) solution but I need to out ~2.7 Mb. It's takes ~0.12 sec. So, how this problem can be solved in 0.062? So, nobody wants to answer me. It's pity. printf too slow you can use fwrite(), but first you need to translate the numbers into a string fwrite() also too slow ))) give me some hints please! i used set<_int64> from STL Edited by author 28.08.2009 19:43 Use hash instead of set. How use the hash_set ?? i write in C++. try to write your own hash_set, it is not so difficult however you don't need any hash or set there i don't know how to deal with it. I get WA1.. Why? for 3 my answer is "1 3 2" I think for 3 you answer is correct. What you answer for 2? Now I got AC. But I don't know that I fixed. New problem "Perfect Sequence" was added to the Problem set. Thanks to Aleksandr Bacherikov. |
|
|