Educational Codeforces Round 147 (Rated for 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
1821 Educational Codeforces Round 147 (Rated for Div. 2) FINISHED False 7200 49821899 April 20, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5027 ) D Black Cells PROGRAMMING binary search brute force greedy math

B'You are playing with a really long strip consisting of 10^{18} white cells, numbered from left to right as 0 , 1 , 2 and so on. You are controlling a special pointer that is initially in cell 0 . Also, you have a "Shift" button you can press and hold. In one move, you can do one of three actions: Your goal is to color at least k cells, but there is a restriction: you are given n segments [l_i, r_i] -- you can color cells only inside these segments, i. e. you can color the cell x if and only if l_i <= x <= r_i for some i . What is the minimum number of moves you need to make in order to color at least k cells black? 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 ; 1 <= k <= 10^9 ) -- the number of segments and the desired number of black cells, respectively. The second line contains n integers l_1, l_2, ... , l_n ( 1 <= l_1 < l_2 < ... < l_n <= 10^9 ), where l_i is the left border of the i -th segment. The third line contains n integers r_1, r_2, ... , r_n ( 1 <= r_i <= 10^9 ; l_i <= r_i < l_{i + 1} - 1 ), where r_i is the right border of the i -th segment. Additional constraints on the input: For each test case, print the minimum number of moves to color at least k cells black, or -1 if it 's impossible. In the first test case, one of the optimal sequences of operations is the following: In the second test case, we can color at most 8 cells, while we need 20 cell to color. In the third test case, one of the optimal sequences of operations is the following: '...

Tutorials

115296

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
202971775 John_27_Max D April 21, 2023, 4:17 p.m. OK C# 10 TESTS 21 280 34611200
202886580 rainboy D April 20, 2023, 5:11 p.m. OK GNU C11 TESTS 21 93 3174400
202937227 sacave D April 21, 2023, 8:59 a.m. OK GNU C++14 TESTS 21 93 1638400
203008984 JiangRH D April 22, 2023, 5:16 a.m. OK GNU C++14 TESTS 21 108 1638400
202910584 taro0x3f D April 21, 2023, 1:57 a.m. OK GNU C++14 TESTS 21 109 1638400
202975141 vishalsingh_88 D April 21, 2023, 5 p.m. OK GNU C++14 TESTS 21 109 1638400
202991767 omeganot D April 21, 2023, 9:44 p.m. OK GNU C++14 TESTS 21 109 3174400
203001153 luogu_bot5 D April 22, 2023, 2:29 a.m. OK GNU C++14 TESTS 21 109 3174400
202931810 WATL D April 21, 2023, 7:47 a.m. OK GNU C++14 TESTS 21 109 6451200
202910586 Right_One D April 21, 2023, 1:57 a.m. OK GNU C++14 TESTS 21 109 7987200
202894815 Anumoy_nandy D April 20, 2023, 6:50 p.m. OK GNU C++14 TESTS 21 109 10035200
203004368 f_cloud D April 22, 2023, 3:51 a.m. OK GNU C++14 TESTS 21 124 3174400
202924227 _Unchained D April 21, 2023, 6:14 a.m. OK GNU C++17 TESTS 21 93 1638400
202907779 fakedAC D April 21, 2023, 12:30 a.m. OK GNU C++17 TESTS 21 108 1638400
202920990 walk_alone D April 21, 2023, 5:40 a.m. OK GNU C++17 TESTS 21 108 6041600
202926237 jyhyds D April 21, 2023, 6:32 a.m. OK GNU C++17 TESTS 21 109 1638400
202894695 AuroraAlaska D April 20, 2023, 6:48 p.m. OK GNU C++17 TESTS 21 109 1638400
202934846 LY.Leocsse D April 21, 2023, 8:27 a.m. OK GNU C++17 TESTS 21 109 1638400
202927473 dlwc D April 21, 2023, 6:45 a.m. OK GNU C++17 TESTS 21 109 7987200
202982982 shantol D April 21, 2023, 6:47 p.m. OK GNU C++17 TESTS 21 124 1638400
202973930 lxyb D April 21, 2023, 4:44 p.m. OK GNU C++17 TESTS 21 124 1638400
202967010 NguyenYinder D April 21, 2023, 3:21 p.m. OK GNU C++17 TESTS 21 124 1638400
202905292 enslaved D April 20, 2023, 11:02 p.m. OK GNU C++17 (64) TESTS 21 77 1638400
202904045 GoodFella D April 20, 2023, 10:21 p.m. OK GNU C++17 (64) TESTS 21 77 1638400
202887518 Catee D April 20, 2023, 5:20 p.m. OK GNU C++17 (64) TESTS 21 77 1638400
202938259 Lenlynn D April 21, 2023, 9:13 a.m. OK GNU C++17 (64) TESTS 21 77 3174400
202943998 cwxcai D April 21, 2023, 10:31 a.m. OK GNU C++17 (64) TESTS 21 77 3174400
202920968 ___gcd D April 21, 2023, 5:40 a.m. OK GNU C++17 (64) TESTS 21 77 3174400
202957260 tomato_potato D April 21, 2023, 1:28 p.m. OK GNU C++17 (64) TESTS 21 77 3993600
202884910 michao D April 20, 2023, 4:56 p.m. OK GNU C++17 (64) TESTS 21 77 6348800
202976295 dreamoon_love_AA D April 21, 2023, 5:16 p.m. OK GNU C++17 (64) TESTS 21 77 8396800
202913218 0822 D April 21, 2023, 3:03 a.m. OK GNU C++17 (64) TESTS 21 77 9625600
203008679 Zhouershan D April 22, 2023, 5:10 a.m. OK GNU C++20 (64) TESTS 21 31 7987200
202914743 CHN_OMoon D April 21, 2023, 3:42 a.m. OK GNU C++20 (64) TESTS 21 61 1638400
202914117 LostPrince D April 21, 2023, 3:26 a.m. OK GNU C++20 (64) TESTS 21 61 3174400
202919887 SANYASI_RAJA D April 21, 2023, 5:25 a.m. OK GNU C++20 (64) TESTS 21 61 3174400
202908496 INF_512 D April 21, 2023, 12:54 a.m. OK GNU C++20 (64) TESTS 21 61 3174400
202901072 petar_b D April 20, 2023, 9:05 p.m. OK GNU C++20 (64) TESTS 21 61 3174400
202890857 wjli D April 20, 2023, 5:58 p.m. OK GNU C++20 (64) TESTS 21 61 13721600
203008694 Yller D April 22, 2023, 5:11 a.m. OK GNU C++20 (64) TESTS 21 62 1638400
203008121 Yller D April 22, 2023, 5:01 a.m. OK GNU C++20 (64) TESTS 21 62 1638400
202966896 AmirMoris D April 21, 2023, 3:20 p.m. OK GNU C++20 (64) TESTS 21 62 1638400
202931133 manchik D April 21, 2023, 7:37 a.m. OK Go TESTS 21 218 17100800
202900553 harsh.awasthi D April 20, 2023, 8:53 p.m. OK Go TESTS 21 280 10956800
202964505 liangjiahui11 D April 21, 2023, 2:51 p.m. OK Go TESTS 21 280 13312000
202885364 ch2001 D April 20, 2023, 5 p.m. OK Java 11 TESTS 21 249 0
202909675 the_unseen D April 21, 2023, 1:29 a.m. OK Java 11 TESTS 21 295 9216000
202894243 kamranm D April 20, 2023, 6:42 p.m. OK Java 11 TESTS 21 296 103014400
202892194 warks D April 20, 2023, 6:17 p.m. OK Java 11 TESTS 21 311 4812800
202897999 kritikmodi D April 20, 2023, 7:55 p.m. OK Java 11 TESTS 21 358 11878400
203004450 sid234890 D April 22, 2023, 3:53 a.m. OK Java 17 TESTS 21 218 409600
202990611 m0rka1 D April 21, 2023, 9:13 p.m. OK Java 17 TESTS 21 342 8601600
202957252 cnlonces D April 21, 2023, 1:28 p.m. OK Java 17 TESTS 21 389 8704000
203010036 VIVEK_8877 D April 22, 2023, 5:33 a.m. OK Java 17 TESTS 21 436 41369600
202958457 wizardleen D April 21, 2023, 1:40 p.m. OK Java 17 TESTS 21 1309 8294400
202920486 chuquwan9964 D April 21, 2023, 5:33 a.m. OK Java 8 TESTS 21 140 2867200
202888982 swarup_312 D April 20, 2023, 5:36 p.m. OK Java 8 TESTS 21 280 15257600
202914647 Autunomy D April 21, 2023, 3:39 a.m. OK Java 8 TESTS 21 295 24883200
202909968 riyadas.200208 D April 21, 2023, 1:38 a.m. OK Java 8 TESTS 21 389 37478400
202915219 wdjuruo D April 21, 2023, 3:54 a.m. OK Java 8 TESTS 21 763 0
202951728 hideOnHeart D April 21, 2023, 12:24 p.m. OK Java 8 TESTS 21 841 0
202910988 Notasuzu D April 21, 2023, 2:08 a.m. OK MS C++ 2017 TESTS 21 156 1638400
202887764 skimono D April 20, 2023, 5:23 p.m. OK MS C++ 2017 TESTS 21 421 3174400
202959643 adesh123 D April 21, 2023, 1:54 p.m. OK MS C++ 2017 TESTS 21 467 1638400
202887294 Lyle0711 D April 20, 2023, 5:18 p.m. OK PyPy 3 TESTS 21 686 23449600
202977366 KeiTsukishima D April 21, 2023, 5:29 p.m. OK PyPy 3 TESTS 21 1091 47923200
202936239 kuanc D April 21, 2023, 8:45 a.m. OK PyPy 3 TESTS 21 1341 24371200
202907892 CruellaDeVil D April 21, 2023, 12:35 a.m. OK PyPy 3-64 TESTS 21 170 33382400
202906797 CruellaDeVil D April 20, 2023, 11:55 p.m. OK PyPy 3-64 TESTS 21 171 33484800
202886656 zouyu9631 D April 20, 2023, 5:12 p.m. OK PyPy 3-64 TESTS 21 187 39936000
202898657 Boomyday12343 D April 20, 2023, 8:08 p.m. OK PyPy 3-64 TESTS 21 202 33280000
202942765 Yansou D April 21, 2023, 10:13 a.m. OK PyPy 3-64 TESTS 21 217 39628800
202915281 iN_siDious D April 21, 2023, 3:55 a.m. OK PyPy 3-64 TESTS 21 218 36454400
202884674 SoleProprietor D April 20, 2023, 4:54 p.m. OK PyPy 3-64 TESTS 21 234 28979200
202926284 Multiv_Ac D April 21, 2023, 6:32 a.m. OK PyPy 3-64 TESTS 21 249 40755200
202963077 singlabharat D April 21, 2023, 2:34 p.m. OK PyPy 3-64 TESTS 21 264 165888000
202921646 Raindrops1117 D April 21, 2023, 5:48 a.m. OK PyPy 3-64 TESTS 21 296 33894400
202951326 Deepak_Sujay D April 21, 2023, 12:18 p.m. OK Python 3 TESTS 21 467 24780800
202986635 khom D April 21, 2023, 7:50 p.m. OK Python 3 TESTS 21 498 20480000
202905957 momoyao D April 20, 2023, 11:26 p.m. OK Python 3 TESTS 21 545 20070400
202887728 BabyBlue0514 D April 20, 2023, 5:22 p.m. OK Python 3 TESTS 21 748 19558400
202977555 KeiTsukishima D April 21, 2023, 5:32 p.m. OK Python 3 TESTS 21 1450 40448000
202915825 cpchenpi D April 21, 2023, 4:08 a.m. OK Rust 2021 TESTS 21 31 9523200
202965757 p-a-t D April 21, 2023, 3:07 p.m. OK Rust 2021 TESTS 21 93 3174400
202896151 liut D April 20, 2023, 7:13 p.m. OK Rust 2021 TESTS 21 140 3174400
202936850 manchik D April 21, 2023, 8:53 a.m. OK Rust 2021 TESTS 21 155 18329600

remove filters

Back to search problems