There is a contest! | В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.
|
|
imesecan | Oct.12.2015 at 09:53:32 AM | |
0 | --- Test 1 --- 10 2 gz9QNNMyvy 7650 5vFL2eMh3N 5215 F3EUOIl6At 1661 VKazAAVk8O 9899 C0CejMY7rD 3197 uLzADiPDIw 9406 Caf8t434BE 2670 FuMhnzNUzL 6767 G4k3gXCgXS 953 8ih52ceLAA 8723
--- Pattern --- uLzADiPDIw VKazAAVk8O
|
imesecan | Dec.29.2015 at 04:31:41 PM | |
1 | You need to use a data structure like priority_queue here. www.cplusplus.com/reference/queue/priority_queue/
Priority queue gives the opportunity to insert element in logarithmic time and remove element in linear time. Do not keep all the elements in the memory. Just keep m customers all the time.
First, you insert m customers into the queue. Then every time you insert a customer into queue, and you remove a customer who deposits the least.
|
|