Codeforces Round 817 (Div. 4)

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
1722 Codeforces Round 817 (Div. 4) FINISHED False 8100 69952199 Aug. 30, 2022, 2:50 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23546 ) D Line PROGRAMMING greedy sortings 1100

B"There are n people in a horizontal line, each looking either to the left or the right. Each person counts the number of people in the direction they are looking. The value of the line is the sum of each person's count. For example, in the arrangement LRRLL, where L stands for a person looking left and R stands for a person looking right, the counts for each person are [0, 3, 2, 3, 4] , and the value is 0+3+2+3+4=12 . You are given the initial arrangement of people in the line. For each k from 1 to n , determine the maximum value of the line if you can change the direction of at most k people. The input consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 100 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= q n <= q 2 cdot10^5 ) -- the length of the line. The following line contains a string consisting of n characters, each of which is either L or R, representing a person facing left or right, respectively -- the description of the line. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . Please note that the answer for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language (like long long for C++). For each test case, output n space-separated non-negative integers -- the maximum value of the line if you can change the direction of at most k people for each k from 1 to n , inclusive. In the first test case: In the second test case, it is optimal to only change the direction of the first person for all k from 1 to 5 (that is, make the line RRRLL). "...

Tutorials

106478

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
170420390 Antroz D Aug. 31, 2022, 6:59 p.m. OK C# 10 TESTS 6 655 7065600 1100
170381172 Gurveer D Aug. 31, 2022, 11:58 a.m. OK Clang++20 Diagnostics TESTS 6 810 23040000 1100
170358198 zxilly D Aug. 31, 2022, 7:44 a.m. OK Clang++20 Diagnostics TESTS 6 982 21708800 1100
170429572 me39 D Aug. 31, 2022, 10 p.m. OK GNU C11 TESTS 6 873 4403200 1100
170363876 Vist27 D Aug. 31, 2022, 8:49 a.m. OK GNU C11 TESTS 6 920 819200 1100
170409608 MinhThang D Aug. 31, 2022, 4:46 p.m. OK GNU C++14 TESTS 6 61 3584000 1100
170393258 xingsong D Aug. 31, 2022, 1:48 p.m. OK GNU C++14 TESTS 6 62 204800 1100
170435149 GMXH D Sept. 1, 2022, 1:08 a.m. OK GNU C++14 TESTS 6 62 204800 1100
170362005 MR_bh D Aug. 31, 2022, 8:28 a.m. OK GNU C++14 TESTS 6 62 512000 1100
170398613 16shubhamagarwal D Aug. 31, 2022, 2:41 p.m. OK GNU C++14 TESTS 6 62 512000 1100
170390230 ymwang D Aug. 31, 2022, 1:20 p.m. OK GNU C++14 TESTS 6 62 512000 1100
170373383 YXHuang D Aug. 31, 2022, 10:43 a.m. OK GNU C++14 TESTS 6 62 1843200 1100
170355055 Stupido D Aug. 31, 2022, 7:05 a.m. OK GNU C++14 TESTS 6 62 1843200 1100
170439173 pokefunc D Sept. 1, 2022, 3 a.m. OK GNU C++14 TESTS 6 62 3379200 1100
170440071 lxhqwq D Sept. 1, 2022, 3:22 a.m. OK GNU C++14 TESTS 6 62 5324800 1100
170357848 SamuNatsu D Aug. 31, 2022, 7:40 a.m. OK GNU C++17 TESTS 6 46 204800 1100
170362238 WingWingSQ D Aug. 31, 2022, 8:30 a.m. OK GNU C++17 TESTS 6 46 204800 1100
170348657 mdshadesh D Aug. 31, 2022, 5:40 a.m. OK GNU C++17 TESTS 6 61 512000 1100
170392641 Tawfique007 D Aug. 31, 2022, 1:42 p.m. OK GNU C++17 TESTS 6 61 819200 1100
170376905 Ufowoqqqo D Aug. 31, 2022, 11:19 a.m. OK GNU C++17 TESTS 6 61 1843200 1100
170440811 lyj2019 D Sept. 1, 2022, 3:38 a.m. OK GNU C++17 TESTS 6 61 1843200 1100
170380776 sanfen D Aug. 31, 2022, 11:55 a.m. OK GNU C++17 TESTS 6 61 1843200 1100
170349392 Sameer_Mishra100 D Aug. 31, 2022, 5:51 a.m. OK GNU C++17 TESTS 6 61 2150400 1100
170375756 gg0uravgch0uhan D Aug. 31, 2022, 11:07 a.m. OK GNU C++17 TESTS 6 61 2150400 1100
170348297 ttkk D Aug. 31, 2022, 5:36 a.m. OK GNU C++17 TESTS 6 61 2662400 1100
170362031 WWWangYuze D Aug. 31, 2022, 8:28 a.m. OK GNU C++17 (64) TESTS 6 31 1024000 1100
170395011 MoNir_ D Aug. 31, 2022, 2:05 p.m. OK GNU C++17 (64) TESTS 6 31 4608000 1100
170393915 b20_anonymous D Aug. 31, 2022, 1:54 p.m. OK GNU C++17 (64) TESTS 6 31 6758400 1100
170355364 diall_38 D Aug. 31, 2022, 7:09 a.m. OK GNU C++17 (64) TESTS 6 46 204800 1100
170370640 bubaduba D Aug. 31, 2022, 10:15 a.m. OK GNU C++17 (64) TESTS 6 46 512000 1100
170390365 __Aditya__ D Aug. 31, 2022, 1:22 p.m. OK GNU C++17 (64) TESTS 6 46 512000 1100
170425384 Weakness_disgusts_me D Aug. 31, 2022, 8:25 p.m. OK GNU C++17 (64) TESTS 6 46 1331200 1100
170348532 Nutella3000 D Aug. 31, 2022, 5:39 a.m. OK GNU C++17 (64) TESTS 6 46 2150400 1100
170397790 ELgago73 D Aug. 31, 2022, 2:32 p.m. OK GNU C++17 (64) TESTS 6 46 2150400 1100
170437334 qiujunyoujie D Sept. 1, 2022, 2:10 a.m. OK GNU C++17 (64) TESTS 6 46 2355200 1100
170430566 Khattab_11 D Aug. 31, 2022, 10:31 p.m. OK GNU C++20 (64) TESTS 6 15 512000 1100
170411728 imnasim3.1415 D Aug. 31, 2022, 5:12 p.m. OK GNU C++20 (64) TESTS 6 15 2150400 1100
170352002 bin_s D Aug. 31, 2022, 6:26 a.m. OK GNU C++20 (64) TESTS 6 15 2355200 1100
170406262 kc263 D Aug. 31, 2022, 4:07 p.m. OK GNU C++20 (64) TESTS 6 30 204800 1100
170426334 abuhamdeh61 D Aug. 31, 2022, 8:43 p.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170422213 RedE D Aug. 31, 2022, 7:28 p.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170418788 Radle D Aug. 31, 2022, 6:36 p.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170403927 AdithyaS D Aug. 31, 2022, 3:39 p.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170445723 daniyar-is-019_er-2025 D Sept. 1, 2022, 5:26 a.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170444573 s_jaskaran_s D Sept. 1, 2022, 5:04 a.m. OK GNU C++20 (64) TESTS 6 30 512000 1100
170416143 MrReDoX D Aug. 31, 2022, 6:02 p.m. OK Haskell TESTS 6 451 70451200 1100
170354086 liebigbear D Aug. 31, 2022, 6:53 a.m. OK Java 11 TESTS 6 233 3788800 1100
170355725 liebigbear D Aug. 31, 2022, 7:14 a.m. OK Java 11 TESTS 6 233 5017600 1100
170421094 vijender_8601 D Aug. 31, 2022, 7:09 p.m. OK Java 11 TESTS 6 248 0 1100
170404952 deepakjoshi6102 D Aug. 31, 2022, 3:52 p.m. OK Java 11 TESTS 6 249 0 1100
170381876 thedoctor0107 D Aug. 31, 2022, 12:05 p.m. OK Java 11 TESTS 6 249 0 1100
170374249 shek_shek D Aug. 31, 2022, 10:52 a.m. OK Java 11 TESTS 6 249 0 1100
170371313 Singlanavya D Aug. 31, 2022, 10:21 a.m. OK Java 11 TESTS 6 249 0 1100
170441872 SanskarxRawat D Sept. 1, 2022, 4:03 a.m. OK Java 11 TESTS 6 249 307200 1100
170439111 rajan44chauhan D Sept. 1, 2022, 2:58 a.m. OK Java 11 TESTS 6 280 0 1100
170381975 NithinBharathi D Aug. 31, 2022, 12:06 p.m. OK Java 11 TESTS 6 295 7065600 1100
170397717 manimaran_s D Aug. 31, 2022, 2:32 p.m. OK Java 17 TESTS 6 202 0 1100
170352077 zhaoxuelong D Aug. 31, 2022, 6:27 a.m. OK Java 17 TESTS 6 296 614400 1100
170375025 dk.shivam916 D Aug. 31, 2022, 11 a.m. OK Java 17 TESTS 6 841 0 1100
170361410 RaghavGupta22 D Aug. 31, 2022, 8:22 a.m. OK Java 17 TESTS 6 841 512000 1100
170373341 snehpatel01 D Aug. 31, 2022, 10:43 a.m. OK Java 17 TESTS 6 842 2662400 1100
170374467 reactNinja D Aug. 31, 2022, 10:54 a.m. OK Java 17 TESTS 6 857 819200 1100
170387889 agrawal.abhinav98 D Aug. 31, 2022, 1 p.m. OK Java 17 TESTS 6 888 5427200 1100
170438395 sameershaik D Sept. 1, 2022, 2:39 a.m. OK Java 17 TESTS 6 982 5427200 1100
170425698 Lyashenko D Aug. 31, 2022, 8:31 p.m. OK Java 8 TESTS 6 155 0 1100
170359301 Leetcode_Bro D Aug. 31, 2022, 7:58 a.m. OK Java 8 TESTS 6 171 18739200 1100
170406530 ND_ D Aug. 31, 2022, 4:10 p.m. OK Java 8 TESTS 6 202 1024000 1100
170353732 anshulchou_123 D Aug. 31, 2022, 6:48 a.m. OK Java 8 TESTS 6 217 0 1100
170414688 sagbis D Aug. 31, 2022, 5:45 p.m. OK Java 8 TESTS 6 217 17510400 1100
170356866 frey4 D Aug. 31, 2022, 7:29 a.m. OK Java 8 TESTS 6 218 0 1100
170407932 Sussykin D Aug. 31, 2022, 4:27 p.m. OK Java 8 TESTS 6 218 17510400 1100
170417322 mrmouihbi D Aug. 31, 2022, 6:16 p.m. OK Java 8 TESTS 6 233 19046400 1100
170416417 mrmouihbi D Aug. 31, 2022, 6:05 p.m. OK Java 8 TESTS 6 233 19046400 1100
170402300 poopoop D Aug. 31, 2022, 3:21 p.m. OK Java 8 TESTS 6 265 819200 1100
170387645 Nosov_Vovanus2022 D Aug. 31, 2022, 12:57 p.m. OK MS C++ 2017 TESTS 6 124 3686400 1100
170362577 huy_du D Aug. 31, 2022, 8:35 a.m. OK MS C++ 2017 TESTS 6 140 614400 1100
170423701 Vlasov211 D Aug. 31, 2022, 7:55 p.m. OK MS C++ 2017 TESTS 6 140 1433600 1100
170388484 kas181 D Aug. 31, 2022, 1:05 p.m. OK MS C++ 2017 TESTS 6 140 2252800 1100
170361167 wawawawa1 D Aug. 31, 2022, 8:19 a.m. OK MS C++ 2017 TESTS 6 140 2457600 1100
170368920 LIKEJS D Aug. 31, 2022, 9:55 a.m. OK MS C++ 2017 TESTS 6 155 3891200 1100
170382056 MrB0NAN D Aug. 31, 2022, 12:07 p.m. OK MS C++ 2017 TESTS 6 156 3481600 1100
170423191 Vlasov211 D Aug. 31, 2022, 7:45 p.m. OK MS C++ 2017 TESTS 6 171 819200 1100
170423503 Vlasov211 D Aug. 31, 2022, 7:50 p.m. OK MS C++ 2017 TESTS 6 187 819200 1100
170423364 Vlasov211 D Aug. 31, 2022, 7:48 p.m. OK MS C++ 2017 TESTS 6 187 819200 1100
170371987 facebook111111 D Aug. 31, 2022, 10:29 a.m. OK PyPy 3 TESTS 6 405 20275200 1100
170359471 akshat11 D Aug. 31, 2022, 8 a.m. OK PyPy 3 TESTS 6 420 23654400 1100
170435230 MinhQNgo D Sept. 1, 2022, 1:11 a.m. OK PyPy 3 TESTS 6 420 24371200 1100
170430530 SIGCHLD D Aug. 31, 2022, 10:30 p.m. OK PyPy 3 TESTS 6 420 35225600 1100
170364385 rajbunsha D Aug. 31, 2022, 8:55 a.m. OK PyPy 3 TESTS 6 436 20172800 1100
170418430 Prakul_Agrawal D Aug. 31, 2022, 6:31 p.m. OK PyPy 3 TESTS 6 436 20275200 1100
170371627 facebook111111 D Aug. 31, 2022, 10:25 a.m. OK PyPy 3 TESTS 6 436 24166400 1100
170356838 pranay_28 D Aug. 31, 2022, 7:28 a.m. OK PyPy 3 TESTS 6 436 25804800 1100
170422017 why_am_I_cursed D Aug. 31, 2022, 7:25 p.m. OK PyPy 3 TESTS 6 592 38297600 1100
170425237 super_puper_mega_star D Aug. 31, 2022, 8:22 p.m. OK PyPy 3-64 TESTS 6 108 15564800 1100
170391307 bjy D Aug. 31, 2022, 1:29 p.m. OK PyPy 3-64 TESTS 6 108 23142400 1100
170418868 saini.laxman2002 D Aug. 31, 2022, 6:37 p.m. OK PyPy 3-64 TESTS 6 109 14643200 1100
170370988 Just-Q3 D Aug. 31, 2022, 10:18 a.m. OK PyPy 3-64 TESTS 6 109 16588800 1100
170435475 NINGucas D Sept. 1, 2022, 1:17 a.m. OK PyPy 3-64 TESTS 6 109 19251200 1100
170401649 pramana D Aug. 31, 2022, 3:14 p.m. OK PyPy 3-64 TESTS 6 124 15667200 1100
170359099 Puloden D Aug. 31, 2022, 7:55 a.m. OK PyPy 3-64 TESTS 6 124 15974400 1100
170402403 sokolow D Aug. 31, 2022, 3:22 p.m. OK PyPy 3-64 TESTS 6 124 16281600 1100
170369576 dungaaa1211 D Aug. 31, 2022, 10:04 a.m. OK PyPy 3-64 TESTS 6 124 18022400 1100
170388226 sarthak2308 D Aug. 31, 2022, 1:03 p.m. OK PyPy 3-64 TESTS 6 124 18124800 1100
170422177 Whoami2003 KirillK1 D Aug. 31, 2022, 7:27 p.m. OK Python 3 TESTS 6 358 23347200 1100
170412784 tnowakow D Aug. 31, 2022, 5:24 p.m. OK Python 3 TESTS 6 389 22425600 1100
170442825 pratyanch_jain D Sept. 1, 2022, 4:26 a.m. OK Python 3 TESTS 6 420 15769600 1100
170375174 happywater D Aug. 31, 2022, 11:01 a.m. OK Python 3 TESTS 6 436 5632000 1100
170400086 UTTAM_02 D Aug. 31, 2022, 2:56 p.m. OK Python 3 TESTS 6 451 6041600 1100
170398009 dabi D Aug. 31, 2022, 2:35 p.m. OK Python 3 TESTS 6 451 6144000 1100
170410001 khd44 D Aug. 31, 2022, 4:51 p.m. OK Python 3 TESTS 6 452 11673600 1100
170372660 Chandu_005 D Aug. 31, 2022, 10:35 a.m. OK Python 3 TESTS 6 452 11980800 1100
170388900 Genicis D Aug. 31, 2022, 1:09 p.m. OK Python 3 TESTS 6 452 19456000 1100
170372133 shades990 D Aug. 31, 2022, 10:30 a.m. OK Python 3 TESTS 6 467 6144000 1100
170445334 Spheniscine D Sept. 1, 2022, 5:19 a.m. OK Rust 2021 TESTS 6 31 7475200 1100

remove filters

Back to search problems