Codeforces Round 508 (Div. 2)

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
1038 Codeforces Round 508 (Div. 2) FINISHED False 7200 195575099 Sept. 6, 2018, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9441 ) C Gambling PROGRAMMING greedy sortings 1300

B"Two players A and B have a list of n integers each. They both want to maximize the subtraction between their score and their opponent's score. In one turn, a player can either add to his score any element from his list (assuming his list is not empty), the element is removed from the list afterward. Or remove an element from his opponent's list (assuming his opponent's list is not empty). Note, that in case there are equal elements in the list only one of them will be affected in the operations above. For example, if there are elements {1, 2, 2, 3 } in a list and you decided to choose 2 for the next turn, only a single instance of 2 will be deleted (and added to the score, if necessary). The player A starts the game and the game stops when both lists are empty. Find the difference between A's score and B's score at the end of the game, if both of the players are playing optimally. Optimal play between two players means that both players choose the best possible strategy to achieve the best possible outcome for themselves. In this problem, it means that each player, each time makes a move, which maximizes the final difference between his score and his opponent's score, knowing that the opponent is doing the same. The first line of input contains an integer n ( 1 <= n <= 100 ,000 ) -- the sizes of the list. The second line contains n integers a_i ( 1 <= a_i <= 10^6 ), describing the list of the player A, who starts the game. The third line contains n integers b_i ( 1 <= b_i <= 10^6 ), describing the list of the player B. Output the difference between A's score and B's score ( A-B ) if both of them are playing optimally. In the first example, the game could have gone as follows: Hence, A's score is 1 , B's score is 1 and difference is 0 . There is also another optimal way of playing: The difference in the scores is still 0 . In the second example, irrespecti"...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
61787517 v_shah18 C Oct. 3, 2019, 2:52 p.m. OK Clang++17 Diagnostics TESTS 76 202 0 1300
42648705 Leandro.Acosta C Sept. 7, 2018, 5:24 p.m. OK Clang++17 Diagnostics TESTS 76 1715 22016000 1300
42584111 ia7ck C Sept. 6, 2018, 5:09 p.m. OK D TESTS 76 124 11571200 1300
42719016 rr_ C Sept. 9, 2018, 9:47 p.m. OK D TESTS 76 140 11673600 1300
42578730 ruban C Sept. 6, 2018, 4:40 p.m. OK Delphi TESTS 76 108 70553600 1300
42580150 ZuZKho C Sept. 6, 2018, 4:47 p.m. OK FPC TESTS 76 77 819200 1300
44821373 chaorenhaha C Oct. 25, 2018, 2:41 a.m. OK FPC TESTS 76 77 1228800 1300
42583845 hua_xzx C Sept. 6, 2018, 5:07 p.m. OK FPC TESTS 76 78 819200 1300
42582960 choidu C Sept. 6, 2018, 5:02 p.m. OK FPC TESTS 76 78 819200 1300
42655500 darkus-_- C Sept. 7, 2018, 9:43 p.m. OK FPC TESTS 76 93 819200 1300
42646527 hua_xzx C Sept. 7, 2018, 4:46 p.m. OK FPC TESTS 76 93 819200 1300
42651142 sad101010 C Sept. 7, 2018, 6:33 p.m. OK FPC TESTS 76 93 3174400 1300
42580468 petr577 C Sept. 6, 2018, 4:49 p.m. OK FPC TESTS 76 109 1638400 1300
69530758 ndaidemf C Jan. 25, 2020, 5 p.m. OK GNU C11 TESTS 76 62 7987200 1300
47002034 NoSoul C Dec. 14, 2018, 12:05 p.m. OK GNU C11 TESTS 76 78 819200 1300
42856724 rishiraje C Sept. 14, 2018, 10:04 a.m. OK GNU C11 TESTS 76 78 819200 1300
42603683 17ucs175 C Sept. 7, 2018, 6:31 a.m. OK GNU C11 TESTS 76 78 1536000 1300
56004527 chocrush C June 24, 2019, 2:46 p.m. OK GNU C11 TESTS 76 78 7987200 1300
42650441 RenKai_Z C Sept. 7, 2018, 6:10 p.m. OK GNU C11 TESTS 76 92 1228800 1300
52603978 akash19jain C April 11, 2019, 1:09 p.m. OK GNU C11 TESTS 76 93 1638400 1300
42848718 howard919901 C Sept. 14, 2018, 3:17 a.m. OK GNU C11 TESTS 76 93 1638400 1300
42586537 agrohitkr97 C Sept. 6, 2018, 5:23 p.m. OK GNU C11 TESTS 76 93 6451200 1300
42901323 NgocNguyen C Sept. 15, 2018, 7:16 p.m. OK GNU C11 TESTS 76 109 921600 1300
42581889 chinodesu C Sept. 6, 2018, 4:56 p.m. OK GNU C++11 TESTS 76 46 614400 1300
42915789 Itst C Sept. 16, 2018, 9:35 a.m. OK GNU C++11 TESTS 76 46 819200 1300
42787569 flora715 C Sept. 12, 2018, 5:48 a.m. OK GNU C++11 TESTS 76 46 819200 1300
43820104 Zctoylm C Oct. 5, 2018, 8:17 a.m. OK GNU C++11 TESTS 76 46 819200 1300
43824586 luogu_bot4 C Oct. 5, 2018, 11:11 a.m. OK GNU C++11 TESTS 76 46 819200 1300
46756564 mtmohim C Dec. 8, 2018, 12:02 p.m. OK GNU C++11 TESTS 76 46 819200 1300
46999755 Scut82 C Dec. 14, 2018, 10:54 a.m. OK GNU C++11 TESTS 76 46 819200 1300
63759194 Heartbeat666 C Oct. 30, 2019, 2:23 a.m. OK GNU C++11 TESTS 76 46 819200 1300
63759225 luogu_bot1 C Oct. 30, 2019, 2:24 a.m. OK GNU C++11 TESTS 76 46 819200 1300
42942283 Itst C Sept. 16, 2018, 12:11 p.m. OK GNU C++11 TESTS 76 46 819200 1300
47846974 OO0OO0OO0OO0 C Jan. 2, 2019, 3:16 p.m. OK GNU C++14 TESTS 76 62 819200 1300
42732269 yangshuang C Sept. 10, 2018, 12:12 p.m. OK GNU C++14 TESTS 76 62 819200 1300
62401771 Scut82 C Oct. 12, 2019, 7:37 a.m. OK GNU C++14 TESTS 76 77 819200 1300
62334827 Scut82 C Oct. 10, 2019, 11:52 p.m. OK GNU C++14 TESTS 76 77 819200 1300
62334824 Scut82 C Oct. 10, 2019, 11:52 p.m. OK GNU C++14 TESTS 76 77 819200 1300
55328332 landcold7 C June 9, 2019, 9:27 a.m. OK GNU C++14 TESTS 76 77 819200 1300
52540033 mooswell C April 9, 2019, 5:35 p.m. OK GNU C++14 TESTS 76 77 819200 1300
48986591 evandronmota C Jan. 26, 2019, 12:33 p.m. OK GNU C++14 TESTS 76 77 819200 1300
47608379 Vaidik_Patel_27 C Dec. 28, 2018, 6:43 a.m. OK GNU C++14 TESTS 76 77 819200 1300
64470287 sam_1 C Nov. 7, 2019, 12:53 p.m. OK GNU C++14 TESTS 76 77 819200 1300
42615358 fzh0917 C Sept. 7, 2018, 1:24 p.m. OK GNU C++17 TESTS 76 46 2048000 1300
42819329 Playnext C Sept. 13, 2018, 4:52 a.m. OK GNU C++17 TESTS 76 46 10342400 1300
54071268 vjudge2 C May 13, 2019, 4:23 p.m. OK GNU C++17 TESTS 76 62 819200 1300
42586525 valdomiroapc C Sept. 6, 2018, 5:23 p.m. OK GNU C++17 TESTS 76 62 1024000 1300
43066500 AiChiMomo C Sept. 19, 2018, 5:55 a.m. OK GNU C++17 TESTS 76 62 1638400 1300
45967341 aafds C Nov. 19, 2018, 2:19 p.m. OK GNU C++17 TESTS 76 62 8294400 1300
42898386 JewRaper C Sept. 15, 2018, 5:06 p.m. OK GNU C++17 TESTS 76 62 200396800 1300
55940657 wxyzabcd0123hjklmno C June 22, 2019, 4:26 p.m. OK GNU C++17 TESTS 76 77 819200 1300
56720860 himanshu C July 8, 2019, 4:46 p.m. OK GNU C++17 TESTS 76 77 819200 1300
57493400 vjudge2 C July 22, 2019, 7:49 a.m. OK GNU C++17 TESTS 76 77 819200 1300
45473484 davidguandev C Nov. 9, 2018, 11:17 a.m. OK Go TESTS 76 109 0 1300
43267257 Marii C Sept. 22, 2018, 5:06 p.m. OK Go TESTS 76 217 1638400 1300
42868176 cacophonix C Sept. 14, 2018, 5:03 p.m. OK Go TESTS 76 249 716800 1300
42867679 cacophonix C Sept. 14, 2018, 4:44 p.m. OK Go TESTS 76 295 0 1300
42857322 otter C Sept. 14, 2018, 10:34 a.m. OK Haskell TESTS 76 1170 37990400 1300
42851380 Haar C Sept. 14, 2018, 5:58 a.m. OK Haskell TESTS 76 1216 42188800 1300
65936853 bluesky111 C Nov. 29, 2019, 2:56 a.m. OK Java 8 TESTS 76 140 0 1300
43635729 dyhu083 C Oct. 1, 2018, 8:31 a.m. OK Java 8 TESTS 76 155 0 1300
42649920 bhautik_77 C Sept. 7, 2018, 5:54 p.m. OK Java 8 TESTS 76 155 0 1300
42607424 yAsH.jBp C Sept. 7, 2018, 8:50 a.m. OK Java 8 TESTS 76 155 0 1300
42599858 pj21 C Sept. 7, 2018, 3:48 a.m. OK Java 8 TESTS 76 155 0 1300
42579059 avijit_agarwal C Sept. 6, 2018, 4:42 p.m. OK Java 8 TESTS 76 155 0 1300
42578428 gil.vegliach C Sept. 6, 2018, 4:39 p.m. OK Java 8 TESTS 76 156 0 1300
51226327 shikhart98 C March 12, 2019, 2:17 p.m. OK Java 8 TESTS 76 156 204800 1300
42608414 Itwazonce C Sept. 7, 2018, 9:25 a.m. OK Java 8 TESTS 76 170 0 1300
42601418 74zadua C Sept. 7, 2018, 5 a.m. OK Java 8 TESTS 76 170 0 1300
42697718 NguyenHungCuong C Sept. 9, 2018, 8:26 a.m. OK JavaScript TESTS 76 202 26009600 1300
43371179 stepanovep C Sept. 24, 2018, 2:34 p.m. OK Kotlin TESTS 76 248 3891200 1300
54545265 xiaowuc1 C May 24, 2019, 5:45 a.m. OK Kotlin TESTS 76 390 8192000 1300
54966014 og.kostya C June 2, 2019, 6:27 a.m. OK Mono C# TESTS 76 93 3174400 1300
42702715 TrinidadTobago C Sept. 9, 2018, 11:27 a.m. OK Mono C# TESTS 76 109 16896000 1300
42884395 nastya1199 C Sept. 15, 2018, 8:55 a.m. OK Mono C# TESTS 76 124 18636800 1300
42884379 yakif C Sept. 15, 2018, 8:54 a.m. OK Mono C# TESTS 76 124 19456000 1300
50824368 nemars C March 5, 2019, 2:58 p.m. OK Mono C# TESTS 76 124 25292800 1300
43361310 kostyanf14 C Sept. 24, 2018, 9:24 a.m. OK Mono C# TESTS 76 155 25190400 1300
50824328 nemars C March 5, 2019, 2:56 p.m. OK Mono C# TESTS 76 155 25292800 1300
42680795 teru C Sept. 8, 2018, 4:18 p.m. OK Mono C# TESTS 76 171 22323200 1300
42583784 YouAreTheBest C Sept. 6, 2018, 5:07 p.m. OK Mono C# TESTS 76 171 22835200 1300
43589498 chelogrek C Sept. 29, 2018, 11:24 p.m. OK Mono C# TESTS 76 171 23654400 1300
44976303 vjudge1 C Oct. 28, 2018, 5:45 a.m. OK MS C++ TESTS 76 61 819200 1300
44978748 vjudge1 C Oct. 28, 2018, 7:28 a.m. OK MS C++ TESTS 76 61 819200 1300
52491680 vjudge1 C April 8, 2019, 11:56 a.m. OK MS C++ TESTS 76 62 819200 1300
58694447 vjudge2 C Aug. 13, 2019, 5:19 a.m. OK MS C++ TESTS 76 62 819200 1300
57448581 vjudge1 C July 21, 2019, 8:59 a.m. OK MS C++ TESTS 76 62 819200 1300
57364368 vjudge2 C July 20, 2019, 8:44 a.m. OK MS C++ TESTS 76 62 819200 1300
44978779 vjudge5 C Oct. 28, 2018, 7:29 a.m. OK MS C++ TESTS 76 62 819200 1300
42700006 vjudge4 C Sept. 9, 2018, 9:55 a.m. OK MS C++ TESTS 76 62 1024000 1300
43351741 scorpiowf C Sept. 24, 2018, 2:53 a.m. OK MS C++ TESTS 76 62 1740800 1300
44975767 vjudge4 C Oct. 28, 2018, 5:20 a.m. OK MS C++ TESTS 76 77 819200 1300
62103330 AleksanderBalobanov C Oct. 8, 2019, 9:53 a.m. OK MS C++ 2017 TESTS 76 93 7987200 1300
62956874 pmitkov C Oct. 19, 2019, 8:58 p.m. OK MS C++ 2017 TESTS 76 155 7987200 1300
59782962 sladkayaKlubnichka C Aug. 31, 2019, 4:19 a.m. OK MS C++ 2017 TESTS 76 187 819200 1300
59324068 IbraheemJanajreh C Aug. 22, 2019, 7:37 p.m. OK MS C++ 2017 TESTS 76 187 2150400 1300
51857057 CristianoRonaldo C March 26, 2019, 11:37 a.m. OK MS C++ 2017 TESTS 76 217 7987200 1300
42587657 despairrr C Sept. 6, 2018, 5:29 p.m. OK PascalABC.NET TESTS 76 171 4608000 1300
43095803 mayakin C Sept. 19, 2018, 11:35 p.m. OK PHP TESTS 76 327 14745600 1300
43632545 nishank.suresh C Oct. 1, 2018, 6:31 a.m. OK PyPy 2 TESTS 76 233 10752000 1300
42650946 nealzane C Sept. 7, 2018, 6:27 p.m. OK PyPy 2 TESTS 76 233 10956800 1300
42577332 gilou C Sept. 6, 2018, 4:34 p.m. OK PyPy 2 TESTS 76 233 11161600 1300
54728614 raj1307 C May 27, 2019, 9:05 p.m. OK PyPy 2 TESTS 76 233 11468800 1300
42586962 anshuman16423 C Sept. 6, 2018, 5:25 p.m. OK PyPy 2 TESTS 76 248 9728000 1300
43632871 mayurii C Oct. 1, 2018, 6:43 a.m. OK PyPy 2 TESTS 76 249 10752000 1300
43632532 nishank.suresh C Oct. 1, 2018, 6:30 a.m. OK PyPy 2 TESTS 76 249 10752000 1300
42585074 YESMAths C Sept. 6, 2018, 5:14 p.m. OK PyPy 2 TESTS 76 249 11366400 1300
42576561 kakkarotssj C Sept. 6, 2018, 4:31 p.m. OK PyPy 2 TESTS 76 265 11571200 1300
52517532 LeiviniaBirdway C April 9, 2019, 6:38 a.m. OK PyPy 3 TESTS 76 280 11571200 1300
51042021 ashwaththama C March 8, 2019, 5:19 p.m. OK PyPy 3 TESTS 76 295 11776000 1300
47669537 yellowflash C Dec. 29, 2018, 4:34 a.m. OK PyPy 3 TESTS 76 296 12185600 1300
55578459 SarveshDubey C June 15, 2019, 4:26 a.m. OK PyPy 3 TESTS 76 311 11878400 1300
42664184 itsron143 C Sept. 8, 2018, 6:44 a.m. OK PyPy 3 TESTS 76 327 11776000 1300
42585896 chandak_vikas C Sept. 6, 2018, 5:19 p.m. OK PyPy 3 TESTS 76 327 12288000 1300
42592623 ecnerwala C Sept. 6, 2018, 8:38 p.m. OK PyPy 3 TESTS 76 327 12697600 1300
69589088 rsat1999 C Jan. 26, 2020, 9:32 p.m. OK PyPy 3 TESTS 76 327 13721600 1300
59084325 rjv C Aug. 19, 2019, 10:29 a.m. OK PyPy 3 TESTS 76 327 13721600 1300
69647772 BrahimAymen C Jan. 28, 2020, 2:56 a.m. OK PyPy 3 TESTS 76 327 13824000 1300
42590977 shubhankarsharma00 C Sept. 6, 2018, 7:55 p.m. OK Python 2 TESTS 76 374 7782400 1300
43109413 WooooooooooooooW C Sept. 20, 2018, 10:54 a.m. OK Python 2 TESTS 76 389 7680000 1300
44344659 mukeremali C Oct. 15, 2018, 6:27 a.m. OK Python 2 TESTS 76 420 12185600 1300
42600334 Butane C Sept. 7, 2018, 4:12 a.m. OK Python 2 TESTS 76 421 7782400 1300
44988462 FlyingBag65 C Oct. 28, 2018, 11:39 a.m. OK Python 2 TESTS 76 421 7884800 1300
43988563 onextdg C Oct. 8, 2018, 8:50 a.m. OK Python 2 TESTS 76 436 7782400 1300
42591704 kaif_7 C Sept. 6, 2018, 8:10 p.m. OK Python 2 TESTS 76 436 7987200 1300
42603313 Djok216 C Sept. 7, 2018, 6:18 a.m. OK Python 2 TESTS 76 451 7987200 1300
42578643 wangkan2001 C Sept. 6, 2018, 4:40 p.m. OK Python 2 TESTS 76 467 7782400 1300
42577849 soumyasarkar1998 C Sept. 6, 2018, 4:36 p.m. OK Python 2 TESTS 76 467 7782400 1300
63427432 watchdogs132 C Oct. 26, 2019, 8:13 a.m. OK Python 3 TESTS 76 249 10444800 1300
57301754 vulcanx21 C July 19, 2019, 12:30 a.m. OK Python 3 TESTS 76 265 9728000 1300
51410867 yltx C March 17, 2019, noon OK Python 3 TESTS 76 280 9728000 1300
54704528 lIn_nIl C May 27, 2019, 3:51 a.m. OK Python 3 TESTS 76 296 9728000 1300
42606019 orailly C Sept. 7, 2018, 7:54 a.m. OK Python 3 TESTS 76 311 9420800 1300
47807022 Zhongruiqi9922 C Jan. 1, 2019, 8:11 a.m. OK Python 3 TESTS 76 327 9625600 1300
42595402 EliasMera C Sept. 6, 2018, 11:10 p.m. OK Python 3 TESTS 76 327 9625600 1300
52465489 chaudhary_19 C April 7, 2019, 3:26 p.m. OK Python 3 TESTS 76 327 9728000 1300
44263003 blackmart C Oct. 13, 2018, 3:14 p.m. OK Python 3 TESTS 76 342 9011200 1300
43291379 Hach C Sept. 23, 2018, 11:01 a.m. OK Python 3 TESTS 76 343 9420800 1300
42576862 yakamoto C Sept. 6, 2018, 4:32 p.m. OK Scala TESTS 76 623 1536000 1300

remove filters

Back to search problems