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 |
---|---|---|---|---|---|---|
1969 | Educational Codeforces Round 165 (Rated for Div. 2) | FINISHED | False | 7200 | 22778663 | April 29, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 4808 ) | D | Shop Game | PROGRAMMING | data structures greedy math sortings | 1900 |
B"Alice and Bob are playing a game in the shop. There are n items in the shop; each item has two parameters: a_i (item price for Alice) and b_i (item price for Bob). Alice wants to choose a subset (possibly empty) of items and buy them. After that, Bob does the following: Alice's profit is equal to sum limits_{i in S} b_i - sum limits_{j in T} a_j , where S is the set of items Bob buys from Alice, and T is the set of items Alice buys from the shop. In other words, Alice's profit is the difference between the amount Bob pays her and the amount she spends buying the items. Alice wants to maximize her profit, Bob wants to minimize Alice's profit. Your task is to calculate Alice's profit if both Alice and Bob act optimally. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 2 cdot 10^5 ; 0 <= k <= n ). The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ). The third line contains n integers b_1, b_2, ... , b_n ( 1 <= b_i <= 10^9 ). Additional constraint on the input: the sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case, print a single integer -- Alice's profit if both Alice and Bob act optimally. In the first test case, Alice should buy the 2 -nd item and sell it to Bob, so her profit is 2 - 1 = 1 . In the second test case, Alice should buy the 1 -st, the 2 -nd and the 3 -rd item; then Bob takes the 1 -st item for free and pays for the 2 -nd and the 3 -rd item. Alice's profit is (3+2) - (1+2+1) = 1 . Bob could take 2 -nd item for free instead; this does not change Alice's profit. Bob won't take the 3 -rd item for free, since this would lead to a profit of 2 . "... |
Educational Codeforces Round 165 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
263401087 | Uncertainly | D | May 31, 2024, 2:46 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 1638400 | 1900 | |
262468933 | All2be9s | D | May 25, 2024, 6:34 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 1740800 | 1900 | |
260905326 | dhrxv_ | D | May 14, 2024, 9:38 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 2150400 | 1900 | |
262496421 | bkifhr10 | D | May 25, 2024, 10:29 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 3276800 | 1900 | |
262461882 | bkifhr9 | D | May 25, 2024, 5:28 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 6553600 | 1900 | |
262465951 | bkifhr8 | D | May 25, 2024, 6:10 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 171 | 3174400 | 1900 | |
262465898 | vjudge.1 | D | May 25, 2024, 6:10 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 171 | 3174400 | 1900 | |
260474155 | WhileTrueRP | D | May 11, 2024, 2:57 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 171 | 3174400 | 1900 | |
261220971 | aytidaxd | D | May 16, 2024, 3:45 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 171 | 4300800 | 1900 | |
260883952 | anlanyi | D | May 14, 2024, 6:15 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 171 | 5120000 | 1900 | |
260719460 | suraiyamim38 | D | May 12, 2024, 11:04 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 124 | 24883200 | 1900 | |
260090747 | asdvgy | D | May 9, 2024, 8:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 0 | 1900 | |
259900904 | Anemone_ | D | May 7, 2024, 4:05 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 614400 | 1900 | |
263397364 | Ali_Azzam | D | May 31, 2024, 1:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 819200 | 1900 | |
260897749 | LoveWX | D | May 14, 2024, 8:31 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 1126400 | 1900 | |
262463083 | bkifhr6 | D | May 25, 2024, 5:41 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 1638400 | 1900 | |
261219562 | HowToReachExpert | D | May 16, 2024, 3:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 2457600 | 1900 | |
259970138 | OMoonStars | D | May 8, 2024, 8:25 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 3174400 | 1900 | |
260930917 | nan_ling | D | May 14, 2024, 1:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 3276800 | 1900 | |
262398120 | ItsHABIBA | D | May 24, 2024, 2:15 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 6860800 | 1900 | |
260724365 | gaga999 | D | May 13, 2024, 1:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 62 | 2252800 | 1900 | |
262266526 | UltramanDecker | D | May 23, 2024, 1:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 93 | 307200 | 1900 | |
260806439 | sai_kamal | D | May 13, 2024, 1:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 11161600 | 1900 | |
262947875 | _AhSaN_ | D | May 28, 2024, 2:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 0 | 1900 | |
263192762 | camc | D | May 30, 2024, 12:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 1126400 | 1900 | |
262517336 | hcywoi | D | May 25, 2024, 1:56 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 1638400 | 1900 | |
262266638 | Its_Saikat_19 | D | May 23, 2024, 1:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 3788800 | 1900 | |
260060298 | M0Ren_R33 | D | May 9, 2024, 1:52 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 3788800 | 1900 | |
260815760 | sentinile | D | May 13, 2024, 2:45 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 6963200 | 1900 | |
259957885 | Ado1phosa | D | May 8, 2024, 6:33 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 6963200 | 1900 | |
260769585 | nguyenquocthao00 | D | May 13, 2024, 9:09 a.m. | OK | Go | TESTS | 20 | 187 | 18124800 | 1900 | |
262305347 | Yash9890 | D | May 23, 2024, 7:16 p.m. | OK | Java 21 | TESTS | 20 | 546 | 15257600 | 1900 | |
261114639 | new2ac | D | May 16, 2024, 1:40 a.m. | OK | Java 21 | TESTS | 20 | 561 | 18944000 | 1900 | |
260201334 | 2210030072 | D | May 10, 2024, 4:22 a.m. | OK | Java 21 | TESTS | 20 | 577 | 13721600 | 1900 | |
260728965 | GoldenShadow | D | May 13, 2024, 3:20 a.m. | OK | Java 21 | TESTS | 20 | 593 | 12288000 | 1900 | |
260462253 | asdparasite | D | May 10, 2024, 10:35 p.m. | OK | Java 21 | TESTS | 20 | 593 | 25907200 | 1900 | |
261653633 | chauhanharsh643 | D | May 19, 2024, 12:49 p.m. | OK | Java 21 | TESTS | 20 | 1140 | 16691200 | 1900 | |
263175658 | Inevitable_thanos | D | May 29, 2024, 6:24 p.m. | OK | Java 21 | TESTS | 20 | 1233 | 16281600 | 1900 | |
263173780 | Aryaloy | D | May 29, 2024, 5:53 p.m. | OK | Java 21 | TESTS | 20 | 1233 | 16281600 | 1900 | |
263175074 | Aryaloy | D | May 29, 2024, 6:14 p.m. | OK | Java 21 | TESTS | 20 | 1249 | 16588800 | 1900 | |
261782448 | yvbf | D | May 20, 2024, 12:59 p.m. | OK | Java 8 | TESTS | 20 | 530 | 11673600 | 1900 | |
262266111 | Sumitsingh7 | D | May 23, 2024, 1:36 p.m. | OK | Java 8 | TESTS | 20 | 531 | 20582400 | 1900 | |
260059454 | linxiaotian | D | May 9, 2024, 1:33 a.m. | OK | Kotlin 1.9 | TESTS | 20 | 718 | 20684800 | 1900 | |
260085827 | Prasham | D | May 9, 2024, 7:31 a.m. | OK | PyPy 3-64 | TESTS | 20 | 515 | 42700800 | 1900 | |
261248749 | SoleProprietor | D | May 16, 2024, 7:57 p.m. | OK | PyPy 3-64 | TESTS | 20 | 562 | 37273600 | 1900 | |
263623357 | the_last_smilodon | D | June 1, 2024, 11:43 a.m. | OK | PyPy 3-64 | TESTS | 20 | 608 | 46489600 | 1900 | |
261248969 | SoleProprietor | D | May 16, 2024, 8 p.m. | OK | PyPy 3-64 | TESTS | 20 | 624 | 44441600 | 1900 | |
262001095 | vaibhav0320 | D | May 21, 2024, 10:49 a.m. | OK | PyPy 3-64 | TESTS | 20 | 656 | 47104000 | 1900 | |
259970643 | 429d51579a491c57 | D | May 8, 2024, 8:30 a.m. | OK | PyPy 3-64 | TESTS | 20 | 671 | 36454400 | 1900 | |
262226711 | itadori_yuji | D | May 23, 2024, 8:21 a.m. | OK | PyPy 3-64 | TESTS | 20 | 702 | 49049600 | 1900 | |
259997396 | timiss | D | May 8, 2024, 12:24 p.m. | OK | PyPy 3-64 | TESTS | 20 | 718 | 40960000 | 1900 | |
262857055 | klu-2100030642 | D | May 27, 2024, 9:25 a.m. | OK | PyPy 3-64 | TESTS | 20 | 812 | 40960000 | 1900 | |
263240304 | DrCoder9146 | D | May 30, 2024, 12:10 p.m. | OK | PyPy 3-64 | TESTS | 20 | 827 | 37683200 | 1900 | |
262966408 | 2210080018 | D | May 28, 2024, 6:19 a.m. | OK | Python 3 | TESTS | 20 | 608 | 58675200 | 1900 | |
261081494 | AaryaD2005 | D | May 15, 2024, 4:29 p.m. | OK | Python 3 | TESTS | 20 | 624 | 42598400 | 1900 | |
261528819 | jonteo_2001 | D | May 18, 2024, 12:22 p.m. | OK | Python 3 | TESTS | 20 | 858 | 44134400 | 1900 | |
263053013 | pranjal_99 | D | May 28, 2024, 6:27 p.m. | OK | Python 3 | TESTS | 20 | 858 | 55603200 | 1900 | |
263060860 | ambak | D | May 28, 2024, 7:59 p.m. | OK | Rust 2021 | TESTS | 20 | 77 | 10137600 | 1900 |
Back to search problems