Codeforces Round 694 (Div. 1)

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
1470 Codeforces Round 694 (Div. 1) FINISHED False 7200 127495511 Jan. 5, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23268 ) A Strange Birthday Party PROGRAMMING dp greedy sortings two pointers

B"Petya organized a strange birthday party. He invited n friends and assigned an integer k_i to the i -th of them. Now Petya would like to give a present to each of them. In the nearby shop there are m unique presents available, the j -th present costs c_j dollars ( 1 <= c_1 <= c_2 <= ldots <= c_m ). It's not allowed to buy a single present more than once. For the i -th friend Petya can either buy them a present j <= k_i , which costs c_j dollars, or just give them c_{k_i} dollars directly. Help Petya determine the minimum total cost of hosting his party. The first input line contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 1 <= q n, m <= q 3 cdot 10^5 ) -- the number of friends, and the number of unique presents available. The following line contains n integers k_1, k_2, ldots, k_n ( 1 <= q k_i <= q m ), assigned by Petya to his friends. The next line contains m integers c_1, c_2, ldots, c_m ( 1 <= c_1 <= c_2 <= ldots <= c_m <= 10^9 ) -- the prices of the presents. It is guaranteed that sum of values n over all test cases does not exceed 3 cdot 10^5 , and the sum of values m over all test cases does not exceed 3 cdot 10^5 . For each test case output a single integer -- the minimum cost of the party. In the first example, there are two test cases. In the first one, Petya has 5 friends and 4 available presents. Petya can spend only 30 dollars if he gives In the second one, Petya has 5 and 5 available presents. Petya can spend only 190 dollars if he gives "...

Tutorials

86464

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
103409552 Gassa A Jan. 5, 2021, 2:58 p.m. OK D TESTS 34 218 23961600
103499076 vectorwyx A Jan. 6, 2021, 4:08 a.m. OK GNU C++11 TESTS 34 46 7270400
103487617 zhoukangyang A Jan. 5, 2021, 11:16 p.m. OK GNU C++11 TESTS 34 46 17408000
103399699 Biadocy A Jan. 5, 2021, 2:45 p.m. OK GNU C++11 TESTS 34 61 2457600
103399471 diamond_dick A Jan. 5, 2021, 2:45 p.m. OK GNU C++11 TESTS 34 61 6656000
103400050 lin_rany2 A Jan. 5, 2021, 2:46 p.m. OK GNU C++11 TESTS 34 62 2457600
103395532 GSHgsh A Jan. 5, 2021, 2:41 p.m. OK GNU C++11 TESTS 34 62 2457600
103501830 GSHgsh A Jan. 6, 2021, 4:54 a.m. OK GNU C++11 TESTS 34 62 2457600
103395811 Alice_foo_foo A Jan. 5, 2021, 2:41 p.m. OK GNU C++11 TESTS 34 62 2457600
103407446 zhylj A Jan. 5, 2021, 2:56 p.m. OK GNU C++11 TESTS 34 62 3993600
103410818 myx12345 A Jan. 5, 2021, 3 p.m. OK GNU C++11 TESTS 34 62 3993600
103485375 SteamTurbine A Jan. 5, 2021, 10:10 p.m. OK GNU C++14 TESTS 34 170 2457600
103495795 Seyaua A Jan. 6, 2021, 3:03 a.m. OK GNU C++14 TESTS 34 171 2355200
103417034 liyh A Jan. 5, 2021, 3:09 p.m. OK GNU C++14 TESTS 34 171 2457600
103396450 Goshkata A Jan. 5, 2021, 2:42 p.m. OK GNU C++14 TESTS 34 171 2457600
103397007 heyuhhh A Jan. 5, 2021, 2:43 p.m. OK GNU C++14 TESTS 34 171 2457600
103399288 beefman A Jan. 5, 2021, 2:45 p.m. OK GNU C++14 TESTS 34 171 2457600
103405089 YANK01 A Jan. 5, 2021, 2:52 p.m. OK GNU C++14 TESTS 34 171 2457600
103408596 Ali_Tavakoli A Jan. 5, 2021, 2:57 p.m. OK GNU C++14 TESTS 34 171 2457600
103496015 junhopark A Jan. 6, 2021, 3:08 a.m. OK GNU C++14 TESTS 34 171 2457600
103485542 SteamTurbine A Jan. 5, 2021, 10:15 p.m. OK GNU C++14 TESTS 34 171 2457600
103395700 J_B_Y A Jan. 5, 2021, 2:41 p.m. OK GNU C++17 TESTS 34 62 2457600
103400551 yukihana0416 A Jan. 5, 2021, 2:46 p.m. OK GNU C++17 TESTS 34 62 19251200
103473944 RCG A Jan. 5, 2021, 7 p.m. OK GNU C++17 TESTS 34 140 2355200
103403650 Hyperbolic A Jan. 5, 2021, 2:50 p.m. OK GNU C++17 TESTS 34 155 2355200
103399074 Aphelios A Jan. 5, 2021, 2:45 p.m. OK GNU C++17 TESTS 34 155 8704000
103504307 rotoZOOM A Jan. 6, 2021, 5:30 a.m. OK GNU C++17 TESTS 34 171 2355200
103396665 stefansav A Jan. 5, 2021, 2:42 p.m. OK GNU C++17 TESTS 34 171 2355200
103396137 Nson A Jan. 5, 2021, 2:42 p.m. OK GNU C++17 TESTS 34 171 2355200
103477818 Ronnie007 A Jan. 5, 2021, 7:47 p.m. OK GNU C++17 TESTS 34 171 2457600
103403095 Roundgod A Jan. 5, 2021, 2:50 p.m. OK GNU C++17 TESTS 34 171 2457600
103395598 LayCurse A Jan. 5, 2021, 2:41 p.m. OK GNU C++17 (64) TESTS 34 31 100761600
103395048 IgorSmirnov A Jan. 5, 2021, 2:41 p.m. OK GNU C++17 (64) TESTS 34 46 2457600
103394014 NotaMotuaQAQ A Jan. 5, 2021, 2:40 p.m. OK GNU C++17 (64) TESTS 34 62 10854400
103393611 Linkus A Jan. 5, 2021, 2:39 p.m. OK GNU C++17 (64) TESTS 34 93 2355200
103397901 STommydx A Jan. 5, 2021, 2:43 p.m. OK GNU C++17 (64) TESTS 34 109 2457600
103406503 Fly_37 A Jan. 5, 2021, 2:54 p.m. OK GNU C++17 (64) TESTS 34 109 3584000
103400351 natsugiri A Jan. 5, 2021, 2:46 p.m. OK GNU C++17 (64) TESTS 34 109 3584000
103404293 Anachor A Jan. 5, 2021, 2:51 p.m. OK GNU C++17 (64) TESTS 34 109 7270400
103406726 aditya_sheth A Jan. 5, 2021, 2:55 p.m. OK GNU C++17 (64) TESTS 34 109 7270400
103400900 NNMochi A Jan. 5, 2021, 2:47 p.m. OK GNU C++17 (64) TESTS 34 109 7270400
103395697 uwi A Jan. 5, 2021, 2:41 p.m. OK Java 11 TESTS 34 233 1945600
103401972 skittles1412 A Jan. 5, 2021, 2:48 p.m. OK Java 11 TESTS 34 234 0
103478886 mathilde A Jan. 5, 2021, 8:03 p.m. OK Java 11 TESTS 34 327 9318400
103419918 insert_cool_handle A Jan. 5, 2021, 3:14 p.m. OK Java 11 TESTS 34 342 4812800
103398611 mikit A Jan. 5, 2021, 2:44 p.m. OK Java 11 TESTS 34 389 12390400
103396066 anhpp A Jan. 5, 2021, 2:42 p.m. OK Java 11 TESTS 34 420 22425600
103491187 Magikarp1 A Jan. 6, 2021, 1:09 a.m. OK Java 11 TESTS 34 436 16076800
103398392 Apfeloxid A Jan. 5, 2021, 2:44 p.m. OK Java 11 TESTS 34 452 22630400
103402578 Agnimandur A Jan. 5, 2021, 2:49 p.m. OK Java 11 TESTS 34 499 21606400
103404270 mphillotry A Jan. 5, 2021, 2:51 p.m. OK Java 11 TESTS 34 514 15462400
103430956 KharYusuf A Jan. 5, 2021, 3:32 p.m. OK Java 8 TESTS 34 217 5120000
103404485 Megabyte A Jan. 5, 2021, 2:51 p.m. OK Java 8 TESTS 34 249 26624000
103403304 polyakoff A Jan. 5, 2021, 2:50 p.m. OK Java 8 TESTS 34 265 26931200
103401949 YahiaSherif A Jan. 5, 2021, 2:48 p.m. OK Java 8 TESTS 34 265 27033600
103397480 dalt A Jan. 5, 2021, 2:43 p.m. OK Java 8 TESTS 34 280 6041600
103408054 martins A Jan. 5, 2021, 2:56 p.m. OK Java 8 TESTS 34 373 27955200
103400143 fetetriste A Jan. 5, 2021, 2:46 p.m. OK Java 8 TESTS 34 389 27852800
103410952 pulkit1411 A Jan. 5, 2021, 3 p.m. OK Java 8 TESTS 34 436 62566400
103476594 Whiplash99 A Jan. 5, 2021, 7:31 p.m. OK Java 8 TESTS 34 498 33996800
103418381 Whiplash99 A Jan. 5, 2021, 3:11 p.m. OK Java 8 TESTS 34 514 35942400
103502092 Spheniscine A Jan. 6, 2021, 4:58 a.m. OK Kotlin TESTS 34 218 0
103500164 Spheniscine A Jan. 6, 2021, 4:26 a.m. OK Kotlin TESTS 34 233 0
103397502 Tlatoani A Jan. 5, 2021, 2:43 p.m. OK Kotlin TESTS 34 639 48128000
103408016 knightL A Jan. 5, 2021, 2:56 p.m. OK Kotlin TESTS 34 857 49049600
103405281 tarattata1 A Jan. 5, 2021, 2:52 p.m. OK MS C++ 2017 TESTS 34 202 3584000
103396098 pichulia A Jan. 5, 2021, 2:42 p.m. OK MS C++ 2017 TESTS 34 202 11980800
103408491 lioshik_ A Jan. 5, 2021, 2:57 p.m. OK MS C++ 2017 TESTS 34 514 4812800
103483370 letshavesomefun A Jan. 5, 2021, 9:22 p.m. OK MS C++ 2017 TESTS 34 514 4812800
103400691 terry_u16 A Jan. 5, 2021, 2:47 p.m. OK .NET Core C# TESTS 34 140 4505600
103403915 azukun A Jan. 5, 2021, 2:51 p.m. OK .NET Core C# TESTS 34 233 57856000
103398160 fairy_lettuce A Jan. 5, 2021, 2:44 p.m. OK .NET Core C# TESTS 34 233 62976000
103400437 mban259 A Jan. 5, 2021, 2:46 p.m. OK .NET Core C# TESTS 34 265 57753600
103400951 Yupiteru A Jan. 5, 2021, 2:47 p.m. OK .NET Core C# TESTS 34 436 37171200
103399971 keymoon A Jan. 5, 2021, 2:46 p.m. OK .NET Core C# TESTS 34 451 74956800
103395910 bcollet A Jan. 5, 2021, 2:41 p.m. OK PyPy 2 TESTS 34 280 30515200
103411162 alexwice A Jan. 5, 2021, 3:01 p.m. OK PyPy 2 TESTS 34 311 30515200
103396088 realnimish A Jan. 5, 2021, 2:42 p.m. OK PyPy 2 TESTS 34 311 32256000
103400658 yuusanlondon A Jan. 5, 2021, 2:47 p.m. OK PyPy 3 TESTS 34 343 39936000
103397729 not_tehlka A Jan. 5, 2021, 2:43 p.m. OK PyPy 3 TESTS 34 358 37068800
103431479 conqueror_of_tourist A Jan. 5, 2021, 3:33 p.m. OK PyPy 3 TESTS 34 358 40448000
103482473 blinovsv A Jan. 5, 2021, 9:03 p.m. OK PyPy 3 TESTS 34 373 36761600
103395703 TheVan A Jan. 5, 2021, 2:41 p.m. OK PyPy 3 TESTS 34 374 36352000
103399263 chinerist A Jan. 5, 2021, 2:45 p.m. OK PyPy 3 TESTS 34 405 34713600
103406337 at_f A Jan. 5, 2021, 2:54 p.m. OK PyPy 3 TESTS 34 498 45465600
103410099 jimm89 A Jan. 5, 2021, 2:59 p.m. OK PyPy 3 TESTS 34 623 59289600
103476191 MoNsTeR_CuBe A Jan. 5, 2021, 7:26 p.m. OK PyPy 3 TESTS 34 655 30617600
103498675 safeers A Jan. 6, 2021, 4:01 a.m. OK PyPy 3 TESTS 34 670 29696000
103452436 nwi A Jan. 5, 2021, 4:16 p.m. OK Python 2 TESTS 34 514 22016000
103482770 blinovsv A Jan. 5, 2021, 9:10 p.m. OK Python 3 TESTS 34 561 35532800
103494776 saiprasadjnv A Jan. 6, 2021, 2:40 a.m. OK Python 3 TESTS 34 577 31436800
103423877 mkawa2 A Jan. 5, 2021, 3:20 p.m. OK Python 3 TESTS 34 935 34201600
103398893 sansen A Jan. 5, 2021, 2:44 p.m. OK Rust TESTS 34 77 12902400
103402650 cottoncotton A Jan. 5, 2021, 2:49 p.m. OK Rust TESTS 34 78 10137600
103400280 dp0 A Jan. 5, 2021, 2:46 p.m. OK Rust TESTS 34 139 31846400

remove filters

Back to search problems