|
|
Show all threads Hide all threads Show all messages Hide all messages | What is test 7? | So Sui Ming | 2123. Knapsack | 29 May 2024 19:03 | 2 | WA on test 7. I've used uint64_t in array and sum, and int64_t in result. Corner case of sum = 0 is taken care of. Regards, So Sui Ming even signed long long should work fine. try to find error in your solution | hint | ironchat(ITMO) | 2123. Knapsack | 13 Aug 2022 10:27 | 2 | hint ironchat(ITMO) 9 Aug 2019 16:39 Simple solution, but try to optimize it! If you want better explanation (myironmistake@gmail.com) Simple recursion from highest weight down to lowest with proper cut-off on maximal reachable weight and caching of results gives AC in 0.015 sec and 1Mb RAM. I write that spoiler here because I suspects that tests are very weak because I have no proof of why this straightforward thing works so fast when problem has 4-sec/256Mb limits. | WA34 | Zergatul | 2123. Knapsack | 25 Oct 2020 02:21 | 1 | WA34 Zergatul 25 Oct 2020 02:21 Use 64 bit integer for resulting value. Initially I didn't believe result can be this big and spent a lot of time looking for another possible issues with code. |
|
|
|