Codeforces Round 854 by cybercats (Div. 1 + 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
1799 Codeforces Round 854 by cybercats (Div. 1 + Div. 2) FINISHED False 10800 59671463 Feb. 27, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2598 ) D2 Hot Start Up (hard version) PROGRAMMING data structures dp

B'This is a hard version of the problem. The constraints of t , n , k are the only difference between versions. You have a device with two CPUs. You also have k programs, numbered 1 through k , that you can run on the CPUs. The i -th program ( 1 <= i <= k ) takes cold_i seconds to run on some CPU. However, if the last program we ran on this CPU was also program i , it only takes hot_i seconds ( hot_i <= cold_i ). Note that this only applies if we run program i multiple times consecutively -- if we run program i , then some different program, then program i again, it will take cold_i seconds the second time. You are given a sequence a_1, a_2, ldots, a_n of length n , consisting of integers from 1 to k . You need to use your device to run programs a_1, a_2, ldots, a_n in sequence. For all 2 <= i <= n , you cannot start running program a_i until program a_{i - 1} has completed. Find the minimum amount of time needed to run all programs a_1, a_2, ldots, a_n in sequence. Input consists of multiple test cases. The first line contains a single integer t , the number of test cases ( 1 <= t <= 10^5 ). The first line of each test case contains n and k ( 1 <= n, k <= 3 cdot 10^5 ). The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= k ). The third line of each test case contains k integers cold_1, cold_2, ldots, cold_k ( 1 <= cold_i <= 10^9 ). The fourth line of each test case contains k integers hot_1, hot_2, ldots, hot_k ( 1 <= hot_i <= cold_i ). It is guaranteed the sum of n and the sum of k over all test cases do not exceed 3 cdot 10^5 . For each test case, print the minimum time needed to run all programs in the given order. In the first test case, we can do the following: In t'...

Tutorials

Codeforces Round #854 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
195179422 Tdyx D2 Feb. 27, 2023, 4:48 p.m. OK C# 10 TESTS 28 217 60518400
195189137 DmitriyAnikeyev D2 Feb. 27, 2023, 5:32 p.m. OK C# 10 TESTS 28 779 139059200
195196997 rainboy D2 Feb. 27, 2023, 6:36 p.m. OK GNU C11 TESTS 28 592 6041600
195188591 Ice_teapoy D2 Feb. 27, 2023, 5:30 p.m. OK GNU C++14 TESTS 28 249 28057600
195232802 JoesSR D2 Feb. 28, 2023, 5:53 a.m. OK GNU C++14 TESTS 28 264 6041600
195173837 zsyzsy D2 Feb. 27, 2023, 4:24 p.m. OK GNU C++14 TESTS 28 265 6041600
195182945 yyf_0404 D2 Feb. 27, 2023, 5:05 p.m. OK GNU C++14 TESTS 28 265 6041600
195224747 2000032139cse D2 Feb. 28, 2023, 3:25 a.m. OK GNU C++14 TESTS 28 280 6041600
195223196 Tony2_CF D2 Feb. 28, 2023, 2:52 a.m. OK GNU C++14 TESTS 28 280 8396800
195176942 _Diu_ D2 Feb. 27, 2023, 4:37 p.m. OK GNU C++14 TESTS 28 280 10854400
195230641 wangzirui123 D2 Feb. 28, 2023, 5:15 a.m. OK GNU C++14 TESTS 28 280 11980800
195230670 wangzirui123 D2 Feb. 28, 2023, 5:15 a.m. OK GNU C++14 TESTS 28 280 12083200
195220717 Yuki991 D2 Feb. 28, 2023, 1:45 a.m. OK GNU C++14 TESTS 28 280 20684800
195179360 lddlinan D2 Feb. 27, 2023, 4:48 p.m. OK GNU C++17 TESTS 28 202 36044800
195186295 JeffreyLC D2 Feb. 27, 2023, 5:20 p.m. OK GNU C++17 TESTS 28 233 9625600
195207978 Md._Nahid_Ullah_Joy D2 Feb. 27, 2023, 8:46 p.m. OK GNU C++17 TESTS 28 249 6041600
195224119 -skyline- D2 Feb. 28, 2023, 3:12 a.m. OK GNU C++17 TESTS 28 249 6041600
195181185 igz D2 Feb. 27, 2023, 4:56 p.m. OK GNU C++17 TESTS 28 265 9625600
195172236 bIeahbIeah D2 Feb. 27, 2023, 4:18 p.m. OK GNU C++17 TESTS 28 265 11980800
195208204 Md._Nahid_Ullah_Joy D2 Feb. 27, 2023, 8:49 p.m. OK GNU C++17 TESTS 28 280 6041600
195179572 lethan3 D2 Feb. 27, 2023, 4:49 p.m. OK GNU C++17 TESTS 28 280 8396800
195228072 Rockey D2 Feb. 28, 2023, 4:29 a.m. OK GNU C++17 TESTS 28 280 8396800
195217189 a757403 D2 Feb. 27, 2023, 11:55 p.m. OK GNU C++17 TESTS 28 280 10854400
195231178 Noxus D2 Feb. 28, 2023, 5:23 a.m. OK GNU C++17 (64) TESTS 28 186 7270400
195221881 narrowkind D2 Feb. 28, 2023, 2:20 a.m. OK GNU C++17 (64) TESTS 28 186 9830400
195172067 SanweiTreap D2 Feb. 27, 2023, 4:17 p.m. OK GNU C++17 (64) TESTS 28 186 12083200
195221501 lqx2005 D2 Feb. 28, 2023, 2:09 a.m. OK GNU C++17 (64) TESTS 28 186 13209600
195177541 ibrahim001 D2 Feb. 27, 2023, 4:40 p.m. OK GNU C++17 (64) TESTS 28 186 16793600
195222816 chuchu D2 Feb. 28, 2023, 2:43 a.m. OK GNU C++17 (64) TESTS 28 186 27648000
195173484 Shahrad D2 Feb. 27, 2023, 4:23 p.m. OK GNU C++17 (64) TESTS 28 186 64102400
195183932 miscalculation53 D2 Feb. 27, 2023, 5:09 p.m. OK GNU C++17 (64) TESTS 28 187 9625600
195176250 HCPS42 D2 Feb. 27, 2023, 4:34 p.m. OK GNU C++17 (64) TESTS 28 187 12083200
195201822 wnmrmr D2 Feb. 27, 2023, 7:26 p.m. OK GNU C++17 (64) TESTS 28 187 13209600
195173967 oursaco D2 Feb. 27, 2023, 4:25 p.m. OK GNU C++20 (64) TESTS 28 77 35020800
195179196 NRolly D2 Feb. 27, 2023, 4:47 p.m. OK GNU C++20 (64) TESTS 28 124 6041600
195217923 Paul_Liao_1457 D2 Feb. 28, 2023, 12:18 a.m. OK GNU C++20 (64) TESTS 28 124 13209600
195173490 I_LOVE_DASHA_KARPENKO D2 Feb. 27, 2023, 4:23 p.m. OK GNU C++20 (64) TESTS 28 139 8396800
195174342 atodo D2 Feb. 27, 2023, 4:26 p.m. OK GNU C++20 (64) TESTS 28 139 10854400
195180212 arpeggio D2 Feb. 27, 2023, 4:52 p.m. OK GNU C++20 (64) TESTS 28 139 12083200
195179880 ub33 D2 Feb. 27, 2023, 4:51 p.m. OK GNU C++20 (64) TESTS 28 139 12083200
195201868 wnmrmr D2 Feb. 27, 2023, 7:26 p.m. OK GNU C++20 (64) TESTS 28 139 13209600
195182874 mychecksdead D2 Feb. 27, 2023, 5:04 p.m. OK GNU C++20 (64) TESTS 28 139 48128000
195221203 platelet D2 Feb. 28, 2023, 1:59 a.m. OK GNU C++20 (64) TESTS 28 140 6041600
195184799 profchi D2 Feb. 27, 2023, 5:13 p.m. OK Java 11 TESTS 28 997 20480000
195174725 knightL D2 Feb. 27, 2023, 4:28 p.m. OK Java 17 TESTS 28 795 25497600
195206190 golions D2 Feb. 27, 2023, 8:22 p.m. OK Java 8 TESTS 28 311 46899200
195192705 bvf D2 Feb. 27, 2023, 6:05 p.m. OK PyPy 3 TESTS 28 498 56115200
195231138 bvf D2 Feb. 28, 2023, 5:23 a.m. OK PyPy 3 TESTS 28 499 55910400
195231180 bvf D2 Feb. 28, 2023, 5:23 a.m. OK PyPy 3 TESTS 28 920 57241600
195230973 bvf D2 Feb. 28, 2023, 5:20 a.m. OK PyPy 3 TESTS 28 950 57241600
195208022 1_2_3_4_5_9 D2 Feb. 27, 2023, 8:47 p.m. OK PyPy 3-64 TESTS 28 342 107622400
195179761 hulahula3247 D2 Feb. 27, 2023, 4:50 p.m. OK PyPy 3-64 TESTS 28 343 62259200
195209073 00zijian D2 Feb. 27, 2023, 9:01 p.m. OK PyPy 3-64 TESTS 28 343 64716800
195208907 codicon D2 Feb. 27, 2023, 8:59 p.m. OK PyPy 3-64 TESTS 28 358 66560000
195189178 zouyu9631 D2 Feb. 27, 2023, 5:32 p.m. OK PyPy 3-64 TESTS 28 373 79257600
195209002 00zijian D2 Feb. 27, 2023, 9:01 p.m. OK PyPy 3-64 TESTS 28 374 60006400
195180791 FlakeLCR D2 Feb. 27, 2023, 4:55 p.m. OK PyPy 3-64 TESTS 28 467 79564800
195222187 RobinFromTheHood D2 Feb. 28, 2023, 2:27 a.m. OK PyPy 3-64 TESTS 28 483 61849600
195222741 FlakeLCR D2 Feb. 28, 2023, 2:41 a.m. OK PyPy 3-64 TESTS 28 530 79564800
195184971 zz_zye D2 Feb. 27, 2023, 5:14 p.m. OK PyPy 3-64 TESTS 28 654 66867200
195185640 Unwise D2 Feb. 27, 2023, 5:17 p.m. OK Rust 2021 TESTS 28 93 11980800

remove filters

Back to search problems