|  | 
|  | 
| back to board | My solution is O(N * 17) but it fits in memory only on C++. Can anyone give me better solution? My mailbox is vlad_veselov@mail.ru.Re: My solution is O(N * 17) but it fits in memory only on C++. Can anyone give me better solution? My mailbox is vlad_veselov@mail.ru. It is solvable in PASCAL too.AC in 0.046s with 489 KB of memory.
 
 But here is Delphi report:
 "
 Mine is on
 Borland Delphi Version 15.0
 Copyright (c) 1983,2002 Borland Software Corporation
 
 MAGNSTOR.PAS(1)
 MAGNSTOR.PAS(1)
 MAGNSTOR.PAS(1)
 MAGNSTOR.PAS(137)
 138 lines, 0.02 seconds, 11564 bytes code, 113813 bytes data.
 "
 
 It uses only 113813 bytes of memory. If I am not mistaken (I have solved it a long time ago) my solution is O(N log N).
Re: My solution is O(N * 17) but it fits in memory only on C++. Can anyone give me better solution? My mailbox is vlad_veselov@mail.ru. Use Hash-table to store the results !!!!Re: My solution is O(N * 17) but it fits in memory only on C++. Can anyone give me better solution? My mailbox is vlad_veselov@mail.ru. There is O(n) algorithm !!!!!If you want to know more mail me VRomanchik@Tut.by
 | 
 | 
|