Codeforces Round 959 sponsored by NEAR (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
1994 Codeforces Round 959 sponsored by NEAR (Div. 1 + Div. 2) FINISHED False 7200 15866663 July 18, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11221 ) C Hungry Games PROGRAMMING binary search data structures dp two pointers

B'Yaroslav is playing a computer game, and at one of the levels, he encountered n mushrooms arranged in a row. Each mushroom has its own level of toxicity; the i -th mushroom from the beginning has a toxicity level of a_i . Yaroslav can choose two integers 1 <= l <= r <= n , and then his character will take turns from left to right to eat mushrooms from this subsegment one by one, i.e., the mushrooms with numbers l, l+1, l+2, ldots, r . The character has a toxicity level g , initially equal to 0 . The computer game is defined by the number x -- the maximum toxicity level at any given time. When eating a mushroom with toxicity level k , the following happens: Yaroslav became interested in how many ways there are to choose the values of l and r such that the final value of g is not zero. Help Yaroslav find this number! Each test consists of multiple test cases. The first line contains an integer t ( 1 <= t <= 10^{4} ) -- the number of test cases. Then follows the description of the test cases. The first line of each test case contains two integers n , x ( 1 <= q n <= q 2 cdot 10^5, 1 <= x <= 10^9 ) -- the number of mushrooms and the maximum toxicity level. The second line of each test case contains n numbers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ). It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single number -- the number of subsegments such that the final value of g will not be zero. In the first test case, the subsegments (1, 1) , (1, 2) , (1, 4) , (2, 2) , (2, 3) , (3, 3) , (3, 4) and (4, 4) are suitable. In the second test case, non-zero g will remain only on the subsegments (1, 1) and (2, 2) . In the third test case, on the only possible subsegment, g will be zero. '...

Tutorials

Video Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
271256033 A1ternate C July 18, 2024, 4:14 p.m. OK C# 10 TESTS 15 202 25088000
271268276 A1ternate C July 18, 2024, 5:26 p.m. OK C# 10 TESTS 15 234 25088000
271329953 kundan12 C July 19, 2024, 5:58 a.m. OK C++14 (GCC 6-32) TESTS 15 77 1126400
271268974 more-cheese C July 18, 2024, 5:29 p.m. OK C++14 (GCC 6-32) TESTS 15 77 4812800
271259073 rohitdagar957 C July 18, 2024, 4:23 p.m. OK C++14 (GCC 6-32) TESTS 15 78 0
271319525 praneet1300 C July 19, 2024, 4 a.m. OK C++14 (GCC 6-32) TESTS 15 78 409600
271263066 messiuuu C July 18, 2024, 4:33 p.m. OK C++14 (GCC 6-32) TESTS 15 92 3993600
271302713 Heshu C July 19, 2024, 12:59 a.m. OK C++14 (GCC 6-32) TESTS 15 92 5529600
271316946 v_kram4 C July 19, 2024, 3:36 a.m. OK C++14 (GCC 6-32) TESTS 15 93 0
271327458 kx233- C July 19, 2024, 5:34 a.m. OK C++14 (GCC 6-32) TESTS 15 93 0
271327288 NikkiCodes C July 19, 2024, 5:33 a.m. OK C++14 (GCC 6-32) TESTS 15 93 0
271318616 andre_25 C July 19, 2024, 3:51 a.m. OK C++14 (GCC 6-32) TESTS 15 93 0
271308195 RigBuhBuh C July 19, 2024, 2:07 a.m. OK C++17 (GCC 7-32) TESTS 15 62 0
271277321 TsotneSV C July 18, 2024, 6:34 p.m. OK C++17 (GCC 7-32) TESTS 15 77 0
271317393 nithineruventi C July 19, 2024, 3:40 a.m. OK C++17 (GCC 7-32) TESTS 15 77 0
271306577 L---L---L C July 19, 2024, 1:48 a.m. OK C++17 (GCC 7-32) TESTS 15 77 0
271258499 6_sicario_9 C July 18, 2024, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 15 77 307200
271280014 mikacy C July 18, 2024, 7:02 p.m. OK C++17 (GCC 7-32) TESTS 15 77 1126400
271322733 moksh_malhotra C July 19, 2024, 4:38 a.m. OK C++17 (GCC 7-32) TESTS 15 77 1126400
271301795 Dream_of_Glory C July 19, 2024, 12:46 a.m. OK C++17 (GCC 7-32) TESTS 15 77 3993600
271313527 mosuo C July 19, 2024, 3:02 a.m. OK C++17 (GCC 7-32) TESTS 15 78 0
271279282 JML C July 18, 2024, 6:54 p.m. OK C++17 (GCC 7-32) TESTS 15 78 0
271311398 D1stance C July 19, 2024, 2:42 a.m. OK C++20 (GCC 13-64) TESTS 15 62 0
271302913 aklk1ng C July 19, 2024, 1:02 a.m. OK C++20 (GCC 13-64) TESTS 15 62 0
271316869 SLF666 C July 19, 2024, 3:35 a.m. OK C++20 (GCC 13-64) TESTS 15 62 307200
271315895 Cheeseman C July 19, 2024, 3:25 a.m. OK C++20 (GCC 13-64) TESTS 15 62 1126400
271311287 everflame C July 19, 2024, 2:41 a.m. OK C++20 (GCC 13-64) TESTS 15 62 1126400
271279313 daohuyenchi21 C July 18, 2024, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 15 62 1126400
271320858 yanke C July 19, 2024, 4:15 a.m. OK C++20 (GCC 13-64) TESTS 15 62 1228800
271313097 passinho C July 19, 2024, 2:58 a.m. OK C++20 (GCC 13-64) TESTS 15 62 3174400
271303240 tolittle C July 19, 2024, 1:07 a.m. OK C++20 (GCC 13-64) TESTS 15 62 4812800
271260946 EmilyZhi C July 18, 2024, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 15 62 4812800
271258490 KH22.Serge_ C July 18, 2024, 4:21 p.m. OK C# 8 TESTS 15 186 24678400
271305432 Szzzp C July 19, 2024, 1:34 a.m. OK GNU C11 TESTS 15 93 3276800
271310140 SanjivDinakar C July 19, 2024, 2:29 a.m. OK GNU C11 TESTS 15 108 4915200
271262358 yuhangliu1224 C July 18, 2024, 4:31 p.m. OK Go TESTS 15 77 4915200
271296692 ResolIU98 C July 18, 2024, 10:56 p.m. OK Go TESTS 15 1452 9216000
271279242 vinay_panwar C July 18, 2024, 6:54 p.m. OK Java 21 TESTS 15 280 512000
271258250 OsamaNassar C July 18, 2024, 4:20 p.m. OK Java 21 TESTS 15 296 1740800
271317434 mangos194 C July 19, 2024, 3:41 a.m. OK Java 21 TESTS 15 327 614400
271260275 Hastorius C July 18, 2024, 4:26 p.m. OK Java 21 TESTS 15 327 819200
271259164 sahasrad C July 18, 2024, 4:23 p.m. OK Java 21 TESTS 15 327 1228800
271310601 Zhanzhe_Lee C July 19, 2024, 2:34 a.m. OK Java 21 TESTS 15 328 2867200
271255953 Baski_Flex C July 18, 2024, 4:14 p.m. OK Java 21 TESTS 15 343 5222400
271274054 codeWithDarshan C July 18, 2024, 6:06 p.m. OK Java 21 TESTS 15 359 8499200
271263629 WORTH C July 18, 2024, 4:34 p.m. OK Java 21 TESTS 15 374 716800
271258368 nhantran0 C July 18, 2024, 4:21 p.m. OK Java 21 TESTS 15 374 1024000
271288322 SD125 C July 18, 2024, 8:40 p.m. OK Java 8 TESTS 15 171 0
271269242 CipherSphinx_Raj C July 18, 2024, 5:31 p.m. OK Java 8 TESTS 15 171 39219200
271322765 kasinathan_sj C July 19, 2024, 4:39 a.m. OK Java 8 TESTS 15 202 3379200
271267464 tirthgohil1410 C July 18, 2024, 5:23 p.m. OK Java 8 TESTS 15 202 3686400
271277395 Sumitsingh7 C July 18, 2024, 6:35 p.m. OK Java 8 TESTS 15 203 7987200
271262546 viraj07 C July 18, 2024, 4:31 p.m. OK Java 8 TESTS 15 218 7884800
271314139 abhayrajnegi0416 C July 19, 2024, 3:08 a.m. OK Java 8 TESTS 15 233 5632000
271305648 zhai123 C July 19, 2024, 1:37 a.m. OK Java 8 TESTS 15 234 3379200
271269598 Eslam_Ahmed C July 18, 2024, 5:34 p.m. OK Java 8 TESTS 15 234 20787200
271256207 zhai123 C July 18, 2024, 4:15 p.m. OK Java 8 TESTS 15 249 3379200
271263035 CR7SUI C July 18, 2024, 4:32 p.m. OK Kotlin 1.7 TESTS 15 890 136908800
271257618 Your__Mom C July 18, 2024, 4:19 p.m. OK Kotlin 1.9 TESTS 15 483 0
271260932 ahtoh_ C July 18, 2024, 4:28 p.m. OK Node.js TESTS 15 234 52428800
271288956 Random_Coder765 C July 18, 2024, 8:48 p.m. OK PyPy 3 TESTS 15 358 20480000
271255145 Shamek0n C July 18, 2024, 4:12 p.m. OK PyPy 3 TESTS 15 374 18022400
271258379 sushant23538_2 C July 18, 2024, 4:21 p.m. OK PyPy 3 TESTS 15 437 24780800
271282585 prathamsibal81 C July 18, 2024, 7:30 p.m. OK PyPy 3 TESTS 15 452 24064000
271307605 AswadK C July 19, 2024, 2:01 a.m. OK PyPy 3 TESTS 15 467 24371200
271281810 gerogeVT C July 18, 2024, 7:21 p.m. OK PyPy 3 TESTS 15 468 24576000
271300737 RobinFromTheHood C July 19, 2024, 12:26 a.m. OK PyPy 3-64 TESTS 15 140 26931200
271260253 ohys040411 C July 18, 2024, 4:26 p.m. OK PyPy 3-64 TESTS 15 171 26931200
271329272 jvatsal0709 C July 19, 2024, 5:52 a.m. OK PyPy 3-64 TESTS 15 171 27033600
271260500 scyyyyyyyyyy C July 18, 2024, 4:26 p.m. OK PyPy 3-64 TESTS 15 171 28467200
271282121 028 C July 18, 2024, 7:25 p.m. OK PyPy 3-64 TESTS 15 171 32153600
271258593 Joris_Perrenet C July 18, 2024, 4:21 p.m. OK PyPy 3-64 TESTS 15 186 21401600
271309758 crzhou111111 C July 19, 2024, 2:25 a.m. OK PyPy 3-64 TESTS 15 186 26828800
271293839 alexwice C July 18, 2024, 10 p.m. OK PyPy 3-64 TESTS 15 187 30003200
271284054 randombernie C July 18, 2024, 7:47 p.m. OK PyPy 3-64 TESTS 15 202 27033600
271291578 namandamani3112 C July 18, 2024, 9:23 p.m. OK PyPy 3-64 TESTS 15 202 27136000
271318222 CodingKnight C July 19, 2024, 3:48 a.m. OK Python 3 TESTS 15 249 29286400
271317166 CodingKnight C July 19, 2024, 3:38 a.m. OK Python 3 TESTS 15 296 30720000
271261234 prabal_2021344 C July 18, 2024, 4:28 p.m. OK Python 3 TESTS 15 312 29081600
271263271 Pratik___singh C July 18, 2024, 4:33 p.m. OK Python 3 TESTS 15 312 31027200
271258875 itsspriyansh C July 18, 2024, 4:22 p.m. OK Python 3 TESTS 15 327 30208000
271255424 redex C July 18, 2024, 4:13 p.m. OK Python 3 TESTS 15 327 43827200
271256370 derrick2209 C July 18, 2024, 4:15 p.m. OK Python 3 TESTS 15 327 44544000
271260426 Pratham_2021347 C July 18, 2024, 4:26 p.m. OK Python 3 TESTS 15 359 28467200
271313234 Inevitable_way C July 19, 2024, 2:59 a.m. OK Python 3 TESTS 15 359 30720000
271270818 mihir111p C July 18, 2024, 5:42 p.m. OK Python 3 TESTS 15 374 27955200
271261210 suryansh_2003 C July 18, 2024, 4:28 p.m. OK Ruby 3 TESTS 15 905 59596800
271260572 khollbach C July 18, 2024, 4:27 p.m. OK Rust 2021 TESTS 15 77 2560000
271263591 Cheshulko C July 18, 2024, 4:34 p.m. OK Rust 2021 TESTS 15 77 16896000
271261981 kz2d C July 18, 2024, 4:30 p.m. OK Rust 2021 TESTS 15 92 2867200
271260615 udaybindal C July 18, 2024, 4:27 p.m. OK Rust 2021 TESTS 15 108 4710400
271278100 fieubat2x C July 18, 2024, 6:42 p.m. OK Rust 2021 TESTS 15 109 15257600

remove filters

Back to search problems