Codeforces Round 1068 (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
2173 Codeforces Round 1068 (Div. 2) FINISHED False 7200 11460323 Dec. 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 17964 ) B Niko's Tactical Cards PROGRAMMING dp greedy

Niko is playing a game. Her score is denoted by an integer (k) which is (0) initially. The game has (n) turns. On the (i)-th turn, Niko is given a red card with an integer (a_i) on it, as well as a blue card with an integer (b_i) on it. She must choose exactly one of the cards and update her score according to her choice: If she chooses the red card, her score becomes (k - a_i), where (k) is her score before the turn. If she chooses the blue card, her score becomes (b_i - k), where (k) is her score before the turn. After this, the game proceeds to the next turn, or ends if it is the (n)-th turn. Your task is to find the maximum possible score Niko can obtain at the end of the game. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 10^5)) — the number of turns. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((-10^9 \le a_i \le 10^9)). The third line of each test case contains (n) integers (b_1, b_2, \ldots, b_n) ((-10^9 \le b_i \le 10^9)). It is guaranteed that the sum of (n) over all test cases does not exceed (10^5). For each test case, output a single integer — the maximum possible score Niko can obtain at the end of the game. In the first test case, one optimal strategy is as follows:

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
352167633 ksandr1v B Dec. 6, 2025, 5:56 a.m. OK C# 13 TESTS 9 140 4608000
352162521 anuj_2005 B Dec. 6, 2025, 5:13 a.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352150227 orzsigmaenigma B Dec. 6, 2025, 2:55 a.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352139830 joonyury B Dec. 5, 2025, 11:54 p.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352136285 itsmemanuk04 B Dec. 5, 2025, 11:07 p.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352133239 WeakBlood B Dec. 5, 2025, 9:50 p.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352103647 liyuanwei B Dec. 5, 2025, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352097653 Cqrtelb B Dec. 5, 2025, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 9 62 0
352165405 vaibhavg2004 B Dec. 6, 2025, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 9 62 102400
352159605 moradiya84 B Dec. 6, 2025, 4:44 a.m. OK C++17 (GCC 7-32) TESTS 9 62 102400
352146195 try666 B Dec. 6, 2025, 2:08 a.m. OK C++17 (GCC 7-32) TESTS 9 62 102400
352160096 dorasainath955 B Dec. 6, 2025, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352149358 rev_retah B Dec. 6, 2025, 2:45 a.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352130792 Taherr B Dec. 5, 2025, 9:09 p.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352110981 Durjoy-34 B Dec. 5, 2025, 6:02 p.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352109954 A_d1b_A B Dec. 5, 2025, 5:56 p.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352094083 vansh_0722 B Dec. 5, 2025, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 9 46 0
352135825 kaisocool B Dec. 5, 2025, 10:54 p.m. OK C++20 (GCC 13-64) TESTS 9 46 102400
352142536 dark__moon B Dec. 6, 2025, 1:16 a.m. OK C++20 (GCC 13-64) TESTS 9 46 2764800
352164021 Tony_stark8522 B Dec. 6, 2025, 5:28 a.m. OK C++20 (GCC 13-64) TESTS 9 62 0
352158633 krishg_ B Dec. 6, 2025, 4:35 a.m. OK C++20 (GCC 13-64) TESTS 9 62 0
352166695 Bynwgs B Dec. 6, 2025, 5:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352163691 14kxr B Dec. 6, 2025, 5:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352162975 babybro B Dec. 6, 2025, 5:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352161303 wtc B Dec. 6, 2025, 5 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352159055 Abhijeet_Gorai B Dec. 6, 2025, 4:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352158613 tarun.gv2007 B Dec. 6, 2025, 4:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352152809 roni126 B Dec. 6, 2025, 3:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352149725 dhruv4250 B Dec. 6, 2025, 2:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352116397 m7uslim B Dec. 5, 2025, 6:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352113304 HashemSi B Dec. 5, 2025, 6:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 46 0
352169005 utkarsh0234 B Dec. 6, 2025, 6:07 a.m. OK GNU C11 TESTS 9 46 1536000
352153578 Jianghang_Mao B Dec. 6, 2025, 3:36 a.m. OK GNU C11 TESTS 9 46 3174400
352094357 Onyx07 B Dec. 5, 2025, 4:24 p.m. OK GNU C11 TESTS 9 62 716800
352163502 XLLLH B Dec. 6, 2025, 5:22 a.m. OK GNU C11 TESTS 9 62 1536000
352097060 sucharitak_2006 B Dec. 5, 2025, 4:30 p.m. OK GNU C11 TESTS 9 62 1536000
352100141 lululu113322 B Dec. 5, 2025, 4:34 p.m. OK GNU C11 TESTS 9 62 1638400
352167995 Sreyan B Dec. 6, 2025, 5:59 a.m. OK GNU C11 TESTS 9 62 2355200
352167433 prattsss B Dec. 6, 2025, 5:55 a.m. OK GNU C11 TESTS 9 62 2355200
352099969 VALKORION B Dec. 5, 2025, 4:34 p.m. OK GNU C11 TESTS 9 78 1536000
352096436 Madhav_mpm B Dec. 5, 2025, 4:28 p.m. OK GNU C11 TESTS 9 78 1536000
352099009 xiannu116ccc B Dec. 5, 2025, 4:33 p.m. OK Go TESTS 9 62 1740800
352156727 Cai_Guang B Dec. 6, 2025, 4:15 a.m. OK Go TESTS 9 109 5017600
352142270 bailimice B Dec. 6, 2025, 1:11 a.m. OK Go TESTS 9 125 4505600
352164774 debrup7703 B Dec. 6, 2025, 5:34 a.m. OK Java 21 TESTS 9 203 716800
352104479 Tania_Nawyaj B Dec. 5, 2025, 5:23 p.m. OK Java 21 TESTS 9 218 27443200
352159557 Himanshu_khare B Dec. 6, 2025, 4:44 a.m. OK Java 21 TESTS 9 234 204800
352092664 shyamPrajapat B Dec. 5, 2025, 4:21 p.m. OK Java 21 TESTS 9 234 409600
352168524 amit_roy B Dec. 6, 2025, 6:03 a.m. OK Java 21 TESTS 9 234 27955200
352118043 tekka_ity B Dec. 5, 2025, 6:56 p.m. OK Java 21 TESTS 9 250 614400
352106305 akshatjai258 B Dec. 5, 2025, 5:33 p.m. OK Java 21 TESTS 9 265 716800
352094632 harrisongao B Dec. 5, 2025, 4:25 p.m. OK Java 21 TESTS 9 265 819200
352125346 s6ubh B Dec. 5, 2025, 8 p.m. OK Java 21 TESTS 9 281 716800
352164046 Adhikkesh B Dec. 6, 2025, 5:28 a.m. OK Java 21 TESTS 9 281 1024000
352093355 aditya_0013 B Dec. 5, 2025, 4:22 p.m. OK Java 8 TESTS 9 156 3174400
352119109 Extradict B Dec. 5, 2025, 7:05 p.m. OK Java 8 TESTS 9 156 15052800
352156073 nageswarareddy2005 B Dec. 6, 2025, 4:07 a.m. OK Java 8 TESTS 9 406 0
352094464 Ishan1509 B Dec. 5, 2025, 4:24 p.m. OK Java 8 TESTS 9 421 0
352157320 Krishna_Pate B Dec. 6, 2025, 4:21 a.m. OK Java 8 TESTS 9 437 0
352093996 jayasrishanmathi B Dec. 5, 2025, 4:24 p.m. OK Java 8 TESTS 9 437 0
352091214 kapilkundu1380 B Dec. 5, 2025, 4:18 p.m. OK Java 8 TESTS 9 453 0
352093810 Mr.Curious B Dec. 5, 2025, 4:23 p.m. OK Java 8 TESTS 9 468 0
352091485 turtlesprint B Dec. 5, 2025, 4:18 p.m. OK Java 8 TESTS 9 468 13414400
352105923 Shailu_03 B Dec. 5, 2025, 5:31 p.m. OK Java 8 TESTS 9 500 0
352145416 Bloomberg345 B Dec. 6, 2025, 1:58 a.m. OK PyPy 3 TESTS 9 296 13721600
352140671 gopikrishna9968 B Dec. 6, 2025, 12:24 a.m. OK PyPy 3 TESTS 9 343 18329600
352145466 Bloomberg345 B Dec. 6, 2025, 1:58 a.m. OK PyPy 3 TESTS 9 375 11264000
352145146 Bloomberg345 B Dec. 6, 2025, 1:54 a.m. OK PyPy 3 TESTS 9 406 13619200
352093748 Jay_Patil_0101 B Dec. 5, 2025, 4:23 p.m. OK PyPy 3 TESTS 9 437 11468800
352091333 Bloomberg345 B Dec. 5, 2025, 4:18 p.m. OK PyPy 3 TESTS 9 437 20275200
352112619 Ne0B1ade B Dec. 5, 2025, 6:13 p.m. OK PyPy 3-64 TESTS 9 93 16588800
352110950 tassei903 B Dec. 5, 2025, 6:02 p.m. OK PyPy 3-64 TESTS 9 93 26009600
352145296 itzxianfish B Dec. 6, 2025, 1:56 a.m. OK PyPy 3-64 TESTS 9 93 27033600
352092814 sakshamnew2712 B Dec. 5, 2025, 4:21 p.m. OK PyPy 3-64 TESTS 9 109 15257600
352159425 UnunidealC B Dec. 6, 2025, 4:43 a.m. OK PyPy 3-64 TESTS 9 109 15769600
352141543 Vishnu_007 B Dec. 6, 2025, 12:51 a.m. OK PyPy 3-64 TESTS 9 109 15769600
352134234 Mohd.Faizan B Dec. 5, 2025, 10:11 p.m. OK PyPy 3-64 TESTS 9 109 15872000
352161253 dangerousMinimum B Dec. 6, 2025, 5 a.m. OK PyPy 3-64 TESTS 9 109 16793600
352155428 LogicErr B Dec. 6, 2025, 3:59 a.m. OK PyPy 3-64 TESTS 9 109 22937600
352103619 Vanekss B Dec. 5, 2025, 5:19 p.m. OK PyPy 3-64 TESTS 9 109 25497600
352121749 fardeenrafi37 B Dec. 5, 2025, 7:27 p.m. OK Python 2 TESTS 9 234 11980800
352167981 avdhoot001 B Dec. 6, 2025, 5:59 a.m. OK Python 3 TESTS 9 109 15974400
352136384 amod_24 B Dec. 5, 2025, 11:09 p.m. OK Python 3 TESTS 9 109 16588800
352099815 DripCat B Dec. 5, 2025, 4:34 p.m. OK Python 3 TESTS 9 125 16588800
352112309 KAMALASHKUMAARC B Dec. 5, 2025, 6:11 p.m. OK Python 3 TESTS 9 125 17203200
352095675 Priyadarshi100 B Dec. 5, 2025, 4:27 p.m. OK Python 3 TESTS 9 140 16588800
352098737 i.am.aryanraj B Dec. 5, 2025, 4:33 p.m. OK Python 3 TESTS 9 140 17612800
352152824 TimTeng B Dec. 6, 2025, 3:27 a.m. OK Python 3 TESTS 9 140 18329600
352093291 mattias.tammaru B Dec. 5, 2025, 4:22 p.m. OK Python 3 TESTS 9 140 23961600
352091973 xiannu112ccc B Dec. 5, 2025, 4:19 p.m. OK Python 3 TESTS 9 140 25292800
352155233 ss240307646 B Dec. 6, 2025, 3:57 a.m. OK Python 3 TESTS 9 156 16076800

remove filters

Back to search problems