Codeforces Round 828 (Div. 3)

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
1744 Codeforces Round 828 (Div. 3) FINISHED False 8100 110474723 Oct. 16, 2022, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 43669 ) C Traffic Light PROGRAMMING binary search implementation two pointers

You find yourself on an unusual crossroad with a weird traffic light. That traffic light has three possible colors: red (r), yellow (y), green (g). It is known that the traffic light repeats its colors every n seconds and at the i -th second the color s_i is on. That way, the order of the colors is described by a string. For example, if s= "rggry", then the traffic light works as the following: red-green-green-red-yellow-red-green-green-red-yellow- ... and so on. More formally, you are given a string s_1, s_2, ldots, s_n of length n . At the first second the color s_1 is on, at the second -- s_2 , ..., at the n -th second the color s_n is on, at the n + 1 -st second the color s_1 is on and so on. You need to cross the road and that can only be done when the green color is on. You know which color is on the traffic light at the moment, but you don 't know the current moment of time. You need to find the minimum amount of time in which you are guaranteed to cross the road. You can assume that you cross the road immediately. For example, with s= "rggry" and the current color r there are two options: either the green color will be on after 1 second, or after 3 . That way, the answer is equal to 3 -- that is the number of seconds that we are guaranteed to cross the road, if the current color is r. The first line contains a single integer t (1 <= q t <= q 10^4 ) -- the number of test cases. Then the description of the test cases follows. The first line of each test case contains an integer n and a symbol c ( 1 <= q n <= q 2 cdot 10^5 , c is one of allowed traffic light colors r, y or g) -- the length of the string s and the current color of the traffic light. The second line of each test case contains a string s of the length n , consisting of the letters r, y and g. It is guaranteed that the symbol g is in the string $

Tutorials

Codeforces Round #828 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
176638001 patil_gm C Oct. 17, 2022, 4:57 a.m. OK Clang++17 Diagnostics TESTS 12 109 23347200
176636292 SaiBhuvanesh C Oct. 17, 2022, 4:26 a.m. OK Clang++17 Diagnostics TESTS 12 155 13004800
176610197 Abhishek_Tewatia C Oct. 16, 2022, 7:08 p.m. OK GNU C11 TESTS 12 62 3891200
176635369 lms_1012 C Oct. 17, 2022, 4:07 a.m. OK GNU C++14 TESTS 12 15 204800
176635045 luorro C Oct. 17, 2022, 4 a.m. OK GNU C++14 TESTS 12 15 512000
176628721 ankur1 C Oct. 17, 2022, 1:56 a.m. OK GNU C++14 TESTS 12 15 512000
176641273 alexhu C Oct. 17, 2022, 5:54 a.m. OK GNU C++14 TESTS 12 15 512000
176631837 havietthanh C Oct. 17, 2022, 3:01 a.m. OK GNU C++14 TESTS 12 15 921600
176616666 Adnan_md C Oct. 16, 2022, 8:32 p.m. OK GNU C++14 TESTS 12 15 1024000
176600161 PepeTheBuilder_74 C Oct. 16, 2022, 5:32 p.m. OK GNU C++14 TESTS 12 15 1024000
176628842 koushik_ C Oct. 17, 2022, 1:58 a.m. OK GNU C++14 TESTS 12 15 1024000
176616143 joshincr C Oct. 16, 2022, 8:24 p.m. OK GNU C++14 TESTS 12 15 1331200
176627275 XIN1111 C Oct. 17, 2022, 1:19 a.m. OK GNU C++14 TESTS 12 15 1536000
176637056 himanshukumarbhu C Oct. 17, 2022, 4:40 a.m. OK GNU C++17 TESTS 12 15 204800
176636495 28leoleo28 C Oct. 17, 2022, 4:29 a.m. OK GNU C++17 TESTS 12 15 409600
176641734 Mohammed_elaraby C Oct. 17, 2022, 6 a.m. OK GNU C++17 TESTS 12 15 512000
176639955 Rahul139 C Oct. 17, 2022, 5:35 a.m. OK GNU C++17 TESTS 12 15 512000
176638096 coder_sayeed C Oct. 17, 2022, 4:58 a.m. OK GNU C++17 TESTS 12 15 512000
176636784 db_hridoy C Oct. 17, 2022, 4:34 a.m. OK GNU C++17 TESTS 12 15 512000
176634145 mutterpaneer C Oct. 17, 2022, 3:44 a.m. OK GNU C++17 TESTS 12 15 512000
176633100 kargatpwnz C Oct. 17, 2022, 3:25 a.m. OK GNU C++17 TESTS 12 15 512000
176631203 surajmisal18 C Oct. 17, 2022, 2:49 a.m. OK GNU C++17 TESTS 12 15 512000
176641149 david89 C Oct. 17, 2022, 5:52 a.m. OK GNU C++17 TESTS 12 15 512000
176641700 1907195154 C Oct. 17, 2022, 5:59 a.m. OK GNU C++17 (64) TESTS 12 0 512000
176597356 bhatta.subhro C Oct. 16, 2022, 5:13 p.m. OK GNU C++17 (64) TESTS 12 0 2252800
176637207 Diegogrc C Oct. 17, 2022, 4:42 a.m. OK GNU C++17 (64) TESTS 12 15 921600
176631854 your_lie_in_april C Oct. 17, 2022, 3:01 a.m. OK GNU C++17 (64) TESTS 12 15 1024000
176627466 -Victory C Oct. 17, 2022, 1:24 a.m. OK GNU C++17 (64) TESTS 12 15 1024000
176588510 apoorv_me C Oct. 16, 2022, 4:44 p.m. OK GNU C++17 (64) TESTS 12 15 1228800
176603345 Muhammed_Ahmed C Oct. 16, 2022, 6 p.m. OK GNU C++17 (64) TESTS 12 15 1331200
176611438 bulbus C Oct. 16, 2022, 7:24 p.m. OK GNU C++17 (64) TESTS 12 15 1740800
176621697 raunakb0308 C Oct. 16, 2022, 10:07 p.m. OK GNU C++17 (64) TESTS 12 15 2150400
176624784 Jame___boy C Oct. 17, 2022, 12:08 a.m. OK GNU C++17 (64) TESTS 12 15 2150400
176640416 UtTaRaN C Oct. 17, 2022, 5:41 a.m. OK GNU C++20 (64) TESTS 12 0 512000
176630015 Mistouch C Oct. 17, 2022, 2:25 a.m. OK GNU C++20 (64) TESTS 12 0 921600
176636115 Duck_sajin C Oct. 17, 2022, 4:23 a.m. OK GNU C++20 (64) TESTS 12 0 1024000
176635352 ranadip_01 C Oct. 17, 2022, 4:07 a.m. OK GNU C++20 (64) TESTS 12 0 1024000
176628169 tahmidarefin C Oct. 17, 2022, 1:41 a.m. OK GNU C++20 (64) TESTS 12 0 1024000
176597515 iiFadel C Oct. 16, 2022, 5:14 p.m. OK GNU C++20 (64) TESTS 12 0 1024000
176639750 freakin23 C Oct. 17, 2022, 5:32 a.m. OK GNU C++20 (64) TESTS 12 0 1024000
176609177 GO_MO C Oct. 16, 2022, 6:57 p.m. OK GNU C++20 (64) TESTS 12 0 1331200
176603674 the-viz C Oct. 16, 2022, 6:03 p.m. OK GNU C++20 (64) TESTS 12 0 1536000
176613293 sangam432 C Oct. 16, 2022, 7:45 p.m. OK GNU C++20 (64) TESTS 12 0 1740800
176596907 nRookie7 C Oct. 16, 2022, 5:10 p.m. OK Go TESTS 12 46 19968000
176638984 praduman14 C Oct. 17, 2022, 5:19 a.m. OK Java 11 TESTS 12 171 0
176622427 himanshu19468 C Oct. 16, 2022, 10:27 p.m. OK Java 11 TESTS 12 202 24985600
176621574 SpookyJumpyBeans C Oct. 16, 2022, 10:03 p.m. OK Java 11 TESTS 12 233 24473600
176621512 SpookyJumpyBeans C Oct. 16, 2022, 10:02 p.m. OK Java 11 TESTS 12 233 24576000
176603708 Saurabh_jayaswal C Oct. 16, 2022, 6:03 p.m. OK Java 11 TESTS 12 233 24576000
176597281 aadarsh_singh C Oct. 16, 2022, 5:12 p.m. OK Java 11 TESTS 12 233 24576000
176609368 SAY_NO_TO_EDITORIAL C Oct. 16, 2022, 6:59 p.m. OK Java 11 TESTS 12 233 24678400
176634722 NithinBharathi C Oct. 17, 2022, 3:55 a.m. OK Java 11 TESTS 12 265 5324800
176610281 rounakchauhan70 C Oct. 16, 2022, 7:10 p.m. OK Java 11 TESTS 12 296 28262400
176610812 ilasiawo C Oct. 16, 2022, 7:16 p.m. OK Java 11 TESTS 12 296 32256000
176614494 akarshanand2810 C Oct. 16, 2022, 8:01 p.m. OK Java 17 TESTS 12 202 40140800
176626105 Mamimi C Oct. 17, 2022, 12:47 a.m. OK Java 17 TESTS 12 202 40243200
176588138 TJ_Codes C Oct. 16, 2022, 4:43 p.m. OK Java 17 TESTS 12 202 40243200
176614742 akarshanand2810 C Oct. 16, 2022, 8:04 p.m. OK Java 17 TESTS 12 233 40550400
176602885 Dukkha C Oct. 16, 2022, 5:56 p.m. OK Java 17 TESTS 12 233 40755200
176606277 PallabSaha23 C Oct. 16, 2022, 6:27 p.m. OK Java 17 TESTS 12 249 40550400
176641242 Mohammad_Anwar C Oct. 17, 2022, 5:53 a.m. OK Java 17 TESTS 12 265 614400
176619272 Kay0 C Oct. 16, 2022, 9:14 p.m. OK Java 17 TESTS 12 327 40448000
176607959 guinnod C Oct. 16, 2022, 6:45 p.m. OK Java 8 TESTS 12 108 18841600
176602291 priyaroy3370 C Oct. 16, 2022, 5:51 p.m. OK Java 8 TESTS 12 108 18841600
176594764 LiuSheng C Oct. 16, 2022, 4:58 p.m. OK Java 8 TESTS 12 109 18739200
176600636 yashpandey73 C Oct. 16, 2022, 5:36 p.m. OK Java 8 TESTS 12 109 18841600
176621857 Mohamed_A7med C Oct. 16, 2022, 10:11 p.m. OK Java 8 TESTS 12 124 18944000
176635708 fahad00cms C Oct. 17, 2022, 4:14 a.m. OK Java 8 TESTS 12 155 512000
176596140 _NursultaN_ C Oct. 16, 2022, 5:05 p.m. OK Java 8 TESTS 12 156 18841600
176599061 toufique_husein C Oct. 16, 2022, 5:24 p.m. OK Java 8 TESTS 12 156 22118400
176622124 J.Shashwat C Oct. 16, 2022, 10:19 p.m. OK Java 8 TESTS 12 202 19660800
176617956 Saurav0826 C Oct. 16, 2022, 8:52 p.m. OK Java 8 TESTS 12 202 19660800
176594274 yomna11issa C Oct. 16, 2022, 4:56 p.m. OK Kotlin 1.6 TESTS 12 342 28672000
176636472 merzgling C Oct. 17, 2022, 4:29 a.m. OK MS C++ 2017 TESTS 12 30 1433600
176593263 lxllxs C Oct. 16, 2022, 4:52 p.m. OK MS C++ 2017 TESTS 12 30 4608000
176593797 OmarRnr C Oct. 16, 2022, 4:54 p.m. OK MS C++ 2017 TESTS 12 46 1740800
176613131 gharsh_69 C Oct. 16, 2022, 7:43 p.m. OK MS C++ 2017 TESTS 12 61 2150400
176598370 organput C Oct. 16, 2022, 5:19 p.m. OK MS C++ 2017 TESTS 12 61 2457600
176610583 rsFalse C Oct. 16, 2022, 7:13 p.m. OK Perl TESTS 12 46 1945600
176608440 amit_dwivedi C Oct. 16, 2022, 6:50 p.m. OK PyPy 2 TESTS 12 171 28569600
176598836 UCATeamOne C Oct. 16, 2022, 5:23 p.m. OK PyPy 3 TESTS 12 155 21094400
176597178 MohamedHamed123 C Oct. 16, 2022, 5:12 p.m. OK PyPy 3 TESTS 12 170 24166400
176590627 jamerrq C Oct. 16, 2022, 4:47 p.m. OK PyPy 3 TESTS 12 171 24473600
176615011 macieekk C Oct. 16, 2022, 8:08 p.m. OK PyPy 3 TESTS 12 202 25702400
176608189 konstruktor C Oct. 16, 2022, 6:47 p.m. OK PyPy 3 TESTS 12 358 23961600
176600426 kuangren777 C Oct. 16, 2022, 5:35 p.m. OK PyPy 3 TESTS 12 358 32972800
176639376 andrey.starodubtsev C Oct. 17, 2022, 5:26 a.m. OK PyPy 3 TESTS 12 374 8192000
176619858 vishu.ut C Oct. 16, 2022, 9:25 p.m. OK PyPy 3 TESTS 12 436 27136000
176614282 gesuta C Oct. 16, 2022, 7:58 p.m. OK PyPy 3-64 TESTS 12 93 37785600
176613189 deepaklaksman C Oct. 16, 2022, 7:44 p.m. OK PyPy 3-64 TESTS 12 108 30720000
176630700 bokunopicolo C Oct. 17, 2022, 2:39 a.m. OK PyPy 3-64 TESTS 12 109 9011200
176612404 gesuta C Oct. 16, 2022, 7:35 p.m. OK PyPy 3-64 TESTS 12 124 32051200
176623244 omar.gawdat C Oct. 16, 2022, 10:54 p.m. OK PyPy 3-64 TESTS 12 124 40652800
176627857 Yansou C Oct. 17, 2022, 1:34 a.m. OK PyPy 3-64 TESTS 12 140 8704000
176599760 crapcode C Oct. 16, 2022, 5:29 p.m. OK PyPy 3-64 TESTS 12 155 36966400
176595797 sheknows C Oct. 16, 2022, 5:04 p.m. OK PyPy 3-64 TESTS 12 233 31948800
176597842 bekbolbolatov C Oct. 16, 2022, 5:16 p.m. OK PyPy 3-64 TESTS 12 233 36454400
176611114 sahil45 C Oct. 16, 2022, 7:20 p.m. OK PyPy 3-64 TESTS 12 234 34406400
176591497 rafzy15 C Oct. 16, 2022, 4:48 p.m. OK Python 3 TESTS 12 109 5529600
176621154 notxkaran C Oct. 16, 2022, 9:53 p.m. OK Python 3 TESTS 12 124 5324800
176592951 prkshydv C Oct. 16, 2022, 4:51 p.m. OK Python 3 TESTS 12 140 5734400
176590636 dark.knight.007 C Oct. 16, 2022, 4:47 p.m. OK Python 3 TESTS 12 155 10240000
176639602 SamuelAbatneh C Oct. 17, 2022, 5:29 a.m. OK Python 3 TESTS 12 171 716800
176641596 Sahil093 C Oct. 17, 2022, 5:58 a.m. OK Python 3 TESTS 12 171 1126400
176599673 dctr_strange C Oct. 16, 2022, 5:29 p.m. OK Python 3 TESTS 12 171 5120000
176640962 SamuelAbatneh C Oct. 17, 2022, 5:49 a.m. OK Python 3 TESTS 12 186 716800
176594537 varunsh17 C Oct. 16, 2022, 4:57 p.m. OK Python 3 TESTS 12 187 5120000
176595976 dctr_strange C Oct. 16, 2022, 5:05 p.m. OK Python 3 TESTS 12 187 5324800
176635548 arkrde C Oct. 17, 2022, 4:11 a.m. OK Rust 2021 TESTS 12 62 1126400
176626209 Ragib_Hasin C Oct. 17, 2022, 12:51 a.m. OK Rust 2021 TESTS 12 77 1740800

remove filters

Back to search problems