Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1746 | Codeforces Global Round 23 | FINISHED | False | 8100 | 71421863 | Oct. 15, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 97 ) | G | Olympiad Training | PROGRAMMING | binary search geometry sortings |
B"Anton decided to get ready for an Olympiad in Informatics. Ilya prepared n tasks for him to solve. It is possible to submit the solution for the i -th task in the first d_{i} days only. Anton cannot solve more than one task a day. Ilya estimated the usefulness of the i -th tasks as r_{i} and divided the tasks into three topics, the topic of the i -th task is type_{i} . Anton wants to solve exactly a tasks on the first topic, b tasks on the second topic and c tasks on the third topic. Tell Anton if it is possible to do so, and if it is, calculate the maximum total usefulness of the tasks he may solve. The first line of input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains four integers n, a, b, c ( 1 <= n <= 10^5 , 0 <= a, b, c <= n ). The following n lines contain three integers each -- r_i, type_i, d_i ( 0 <= r_i <= 10^{9} , 1 <= type_i <= 3 , 1 <= d_i <= n ). The sum of n over all test cases does not exceed 10^5 . For each test case print -1 if Anton cannot reach his goal; otherwise, print the maximum usefulness of the tasks he will solve. In the first test case from the sample test Anton can solve tasks 2 and 4 . In the second test case from the sample test it is impossible to fulfill Anton's wish. In the third test case from the sample test it is optimal to solve tasks 2 , 3 and 4 . In the last test case from the sample test it is optimal to solve tasks 1 , 2 and 4 . "... |
Codeforces Global Round 23 Editorial |
No solutions yet.