Codeforces Round 852 (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
1793 Codeforces Round 852 (Div. 2) FINISHED False 7200 61075463 Feb. 12, 2023, 8:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21950 ) C Dora and Search PROGRAMMING constructive algorithms data structures two pointers

B"As you know, the girl Dora is always looking for something. This time she was given a permutation, and she wants to find such a subsegment of it that none of the elements at its ends is either the minimum or the maximum of the entire subsegment. More formally, you are asked to find the numbers l and r (1 <= q l <= q r <= q n) such that a_l neq min(a_l, a_{l + 1}, ldots, a_r) , a_l neq max(a_l, a_{l + 1}, ldots, a_r) and a_r neq min(a_l, a_{l + 1}, ldots, a_r) , a_r neq max(a_l, a_{l + 1}, ldots, a_r) . A permutation of length n is an array consisting of n distinct integers from 1 to n in any order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 occurs twice in the array) and [1,3,4] is also not a permutation ( n=3 , but 4 is present in the array). Help Dora find such a subsegment, or tell her that such a subsegment does not exist. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. Description of the test cases follows. For each test case, the first line contains one integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of permutation. The second line contains n distinct integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q n ) -- the elements of permutation. It is guarented that the sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case, output -1 if the desired subsegment does not exist. Otherwise, output two indexes l, r such that [a_{l}, a_{l + 1}, ldots, a_{r}] satisfies all conditions. If there are several solutions, then output any of them. In the first and fourth test cases, it can be shown that there are no desired subsegments. In the second test case, the subsegment [1, 4] satisfies all the conditions, because max(a_1, a_2, a_"...

Tutorials

Codeforces Round #852 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
193387465 PavolKoman C Feb. 12, 2023, 6:44 p.m. OK C# 10 TESTS 14 93 14643200
193422507 NavneetKumar99 C Feb. 13, 2023, 5:41 a.m. OK Clang++20 Diagnostics TESTS 15 733 3174400
193383074 ruban C Feb. 12, 2023, 6:05 p.m. OK Delphi TESTS 14 46 37785600
193370260 1435730 C Feb. 12, 2023, 4:19 p.m. OK GNU C11 TESTS 14 46 1638400
193412328 shenlc C Feb. 13, 2023, 2:05 a.m. OK GNU C11 TESTS 15 62 1638400
193413502 Smallorange C Feb. 13, 2023, 2:34 a.m. OK GNU C11 TESTS 15 78 819200
193422441 namanpahwa20 C Feb. 13, 2023, 5:40 a.m. OK GNU C++14 TESTS 15 46 716800
193416543 suraj.xd C Feb. 13, 2023, 3:46 a.m. OK GNU C++14 TESTS 15 46 819200
193388790 ORIGNAL_SENSEI C Feb. 12, 2023, 6:57 p.m. OK GNU C++14 TESTS 14 46 819200
193385463 M4verick C Feb. 12, 2023, 6:26 p.m. OK GNU C++14 TESTS 14 46 819200
193362940 Njaso C Feb. 12, 2023, 3:14 p.m. OK GNU C++14 TESTS 14 46 819200
193354646 domo0508 C Feb. 12, 2023, 2:02 p.m. OK GNU C++14 TESTS 14 46 819200
193339729 OldTomatofun C Feb. 12, 2023, 11:52 a.m. OK GNU C++14 TESTS 14 46 819200
193419074 haku_suki C Feb. 13, 2023, 4:41 a.m. OK GNU C++14 TESTS 15 46 819200
193420965 _Aghost C Feb. 13, 2023, 5:15 a.m. OK GNU C++14 TESTS 15 46 819200
193421430 jogeshwar01 C Feb. 13, 2023, 5:23 a.m. OK GNU C++14 TESTS 15 46 819200
193416005 Naman-16 C Feb. 13, 2023, 3:35 a.m. OK GNU C++17 TESTS 15 46 819200
193411988 Kizk C Feb. 13, 2023, 1:56 a.m. OK GNU C++17 TESTS 15 46 819200
193411441 beenpow C Feb. 13, 2023, 1:39 a.m. OK GNU C++17 TESTS 15 46 819200
193409139 vaibhavc72 C Feb. 13, 2023, 12:30 a.m. OK GNU C++17 TESTS 14 46 819200
193407300 atakyn C Feb. 12, 2023, 11:36 p.m. OK GNU C++17 TESTS 14 46 819200
193403306 Esraa_A_Gaber C Feb. 12, 2023, 10:05 p.m. OK GNU C++17 TESTS 14 46 819200
193403040 ayushraghuwanshi22 C Feb. 12, 2023, 9:59 p.m. OK GNU C++17 TESTS 14 46 819200
193418469 rahu97847 C Feb. 13, 2023, 4:29 a.m. OK GNU C++17 TESTS 15 46 819200
193417095 raj715426aditya C Feb. 13, 2023, 3:59 a.m. OK GNU C++17 TESTS 15 46 819200
193416482 darkcodercb12 C Feb. 13, 2023, 3:45 a.m. OK GNU C++17 TESTS 15 46 819200
193416235 Remilia1023 C Feb. 13, 2023, 3:40 a.m. OK GNU C++17 (64) TESTS 15 0 1740800
193366392 xyl1234 C Feb. 12, 2023, 3:43 p.m. OK GNU C++17 (64) TESTS 14 15 8089600
193406895 y_combinator C Feb. 12, 2023, 11:26 p.m. OK GNU C++17 (64) TESTS 14 31 819200
193356736 sugam10 C Feb. 12, 2023, 2:21 p.m. OK GNU C++17 (64) TESTS 14 31 819200
193350878 Pippu C Feb. 12, 2023, 1:32 p.m. OK GNU C++17 (64) TESTS 14 31 819200
193414110 tazul110111 C Feb. 13, 2023, 2:47 a.m. OK GNU C++17 (64) TESTS 15 31 819200
193423195 WUUUUDI C Feb. 13, 2023, 5:52 a.m. OK GNU C++17 (64) TESTS 15 31 1638400
193402331 Amer_Oniza10 C Feb. 12, 2023, 9:47 p.m. OK GNU C++17 (64) TESTS 14 31 1638400
193340496 The_Destroyer15 C Feb. 12, 2023, 11:58 a.m. OK GNU C++17 (64) TESTS 14 31 1638400
193334674 jabber_wocky C Feb. 12, 2023, 11:12 a.m. OK GNU C++17 (64) TESTS 14 31 1638400
193415593 Pangbai C Feb. 13, 2023, 3:25 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193415534 oophieoofu C Feb. 13, 2023, 3:23 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193415393 mcuadros C Feb. 13, 2023, 3:20 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193412542 Licykoc C Feb. 13, 2023, 2:11 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193412303 Licykoc C Feb. 13, 2023, 2:04 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193411794 Tommy_Shan C Feb. 13, 2023, 1:50 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193411624 M-ANEEQ C Feb. 13, 2023, 1:45 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193421770 Alice114514 C Feb. 13, 2023, 5:29 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193422675 Shamim_Sorkar C Feb. 13, 2023, 5:43 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193423288 no_name_07 C Feb. 13, 2023, 5:53 a.m. OK GNU C++20 (64) TESTS 15 31 819200
193363828 Panther369 C Feb. 12, 2023, 3:21 p.m. OK Java 11 TESTS 14 217 0
193374275 ok.surazz C Feb. 12, 2023, 4:51 p.m. OK Java 11 TESTS 14 233 0
193418665 rajgupta77540 C Feb. 13, 2023, 4:33 a.m. OK Java 11 TESTS 15 249 8908800
193423008 ku_sad_69 C Feb. 13, 2023, 5:49 a.m. OK Java 11 TESTS 15 264 0
193422906 Anmol081202 C Feb. 13, 2023, 5:47 a.m. OK Java 11 TESTS 15 264 0
193418446 g_square C Feb. 13, 2023, 4:28 a.m. OK Java 11 TESTS 15 295 0
193363486 Jackyjuman C Feb. 12, 2023, 3:18 p.m. OK Java 11 TESTS 14 296 21299200
193383716 vijender_8601 C Feb. 12, 2023, 6:11 p.m. OK Java 11 TESTS 14 327 2969600
193345071 Kempachi C Feb. 12, 2023, 12:41 p.m. OK Java 11 TESTS 14 327 6041600
193394256 creativegiant C Feb. 12, 2023, 7:55 p.m. OK Java 11 TESTS 14 374 16179200
193393232 jimmyd211 C Feb. 12, 2023, 7:43 p.m. OK Java 17 TESTS 14 202 307200
193339672 anikethend1234 C Feb. 12, 2023, 11:51 a.m. OK Java 17 TESTS 14 233 307200
193363786 arpurush C Feb. 12, 2023, 3:20 p.m. OK Java 17 TESTS 14 249 0
193375028 kaifkhan. C Feb. 12, 2023, 4:58 p.m. OK Java 17 TESTS 14 295 307200
193353657 bleach__ C Feb. 12, 2023, 1:54 p.m. OK Java 17 TESTS 14 311 4710400
193357784 Black-Heart C Feb. 12, 2023, 2:30 p.m. OK Java 17 TESTS 14 311 7987200
193366829 ahmed.elbakly C Feb. 12, 2023, 3:47 p.m. OK Java 17 TESTS 14 327 5120000
193347171 Hiranmoy C Feb. 12, 2023, 12:59 p.m. OK Java 17 TESTS 14 482 0
193419389 Suraj1607 C Feb. 13, 2023, 4:47 a.m. OK Java 17 TESTS 15 498 819200
193388230 CoderAman_90 C Feb. 12, 2023, 6:52 p.m. OK Java 17 TESTS 14 499 1024000
193370949 swarup_312 C Feb. 12, 2023, 4:24 p.m. OK Java 8 TESTS 14 109 0
193400165 golions C Feb. 12, 2023, 9:12 p.m. OK Java 8 TESTS 14 124 0
193420124 anubh4v C Feb. 13, 2023, 5:01 a.m. OK Java 8 TESTS 15 124 1843200
193382884 ankit_0207 C Feb. 12, 2023, 6:04 p.m. OK Java 8 TESTS 14 124 1945600
193345262 Koka C Feb. 12, 2023, 12:42 p.m. OK Java 8 TESTS 14 124 1945600
193345195 handle007 C Feb. 12, 2023, 12:42 p.m. OK Java 8 TESTS 14 124 1945600
193390886 vaibhav_1710 C Feb. 12, 2023, 7:19 p.m. OK Java 8 TESTS 14 139 17817600
193337070 gaju_01 C Feb. 12, 2023, 11:29 a.m. OK Java 8 TESTS 14 140 0
193374958 sduMamytbekov C Feb. 12, 2023, 4:57 p.m. OK Java 8 TESTS 14 140 1843200
193396700 tejasS-27 C Feb. 12, 2023, 8:23 p.m. OK Java 8 TESTS 14 140 2662400
193330579 yakamoto C Feb. 12, 2023, 10:32 a.m. OK Kotlin 1.6 TESTS 14 233 0
193335642 Sergey.Bankevich C Feb. 12, 2023, 11:18 a.m. OK Kotlin 1.7 TESTS 14 810 122777600
193337328 1434314294 C Feb. 12, 2023, 11:31 a.m. OK MS C++ 2017 TESTS 14 93 819200
193421326 ishybee C Feb. 13, 2023, 5:21 a.m. OK MS C++ 2017 TESTS 15 140 819200
193379721 mark77 C Feb. 12, 2023, 5:37 p.m. OK MS C++ 2017 TESTS 14 140 819200
193333237 LoTFe C Feb. 12, 2023, 11:04 a.m. OK MS C++ 2017 TESTS 14 140 819200
193339558 SnakeInGryffindor C Feb. 12, 2023, 11:50 a.m. OK MS C++ 2017 TESTS 14 343 819200
193333514 j_ghy_ C Feb. 12, 2023, 11:05 a.m. OK Node.js TESTS 14 312 37683200
193389952 ankitesh C Feb. 12, 2023, 7:08 p.m. OK PyPy 3 TESTS 14 217 15872000
193371664 Yash_Nandwana C Feb. 12, 2023, 4:30 p.m. OK PyPy 3 TESTS 14 233 15667200
193395558 khonshu_99 C Feb. 12, 2023, 8:09 p.m. OK PyPy 3 TESTS 14 358 13721600
193341680 LazyRGuy C Feb. 12, 2023, 12:08 p.m. OK PyPy 3 TESTS 14 374 13824000
193420231 codicon C Feb. 13, 2023, 5:03 a.m. OK PyPy 3 TESTS 15 405 13721600
193364769 broshen C Feb. 12, 2023, 3:29 p.m. OK PyPy 3 TESTS 14 405 13721600
193340231 Andy_Huo C Feb. 12, 2023, 11:56 a.m. OK PyPy 3 TESTS 14 405 14131200
193374438 dorissssy C Feb. 12, 2023, 4:53 p.m. OK PyPy 3 TESTS 14 436 13414400
193336206 Has-Borutocu C Feb. 12, 2023, 11:22 a.m. OK PyPy 3 TESTS 14 452 13312000
193374344 dorissssy C Feb. 12, 2023, 4:52 p.m. OK PyPy 3 TESTS 14 452 13414400
193360032 AndreiZherder C Feb. 12, 2023, 2:50 p.m. OK PyPy 3-64 TESTS 14 124 17100800
193373733 poornaTheja C Feb. 12, 2023, 4:47 p.m. OK PyPy 3-64 TESTS 14 139 17100800
193415979 gardengnome C Feb. 13, 2023, 3:34 a.m. OK PyPy 3-64 TESTS 15 139 19660800
193358072 SophieHatter C Feb. 12, 2023, 2:33 p.m. OK PyPy 3-64 TESTS 14 139 22323200
193335667 andrey545454 C Feb. 12, 2023, 11:18 a.m. OK PyPy 3-64 TESTS 14 140 17100800
193356098 adithya1207 C Feb. 12, 2023, 2:15 p.m. OK PyPy 3-64 TESTS 14 140 18841600
193409134 liucxaaa C Feb. 13, 2023, 12:30 a.m. OK PyPy 3-64 TESTS 14 140 22220800
193342086 namandamani3112 C Feb. 12, 2023, 12:12 p.m. OK PyPy 3-64 TESTS 14 155 19968000
193334580 Su_123 C Feb. 12, 2023, 11:12 a.m. OK PyPy 3-64 TESTS 14 170 20787200
193334140 0mancoder0 C Feb. 12, 2023, 11:08 a.m. OK PyPy 3-64 TESTS 14 170 20787200
193392582 python_098 C Feb. 12, 2023, 7:36 p.m. OK Python 3 TESTS 14 155 14233600
193333274 Uruguay C Feb. 12, 2023, 11:04 a.m. OK Python 3 TESTS 14 171 14233600
193343770 lyreloi C Feb. 12, 2023, 12:29 p.m. OK Python 3 TESTS 14 217 13926400
193395647 A_Ankit C Feb. 12, 2023, 8:10 p.m. OK Python 3 TESTS 14 233 14233600
193335278 infinitix C Feb. 12, 2023, 11:16 a.m. OK Python 3 TESTS 14 233 14233600
193335014 Vishnu_Actual C Feb. 12, 2023, 11:14 a.m. OK Python 3 TESTS 14 233 14233600
193350375 GSD_SANDEEP C Feb. 12, 2023, 1:27 p.m. OK Python 3 TESTS 14 249 13312000
193376163 Kolyanchick C Feb. 12, 2023, 5:07 p.m. OK Python 3 TESTS 14 249 14233600
193369673 tariq05 C Feb. 12, 2023, 4:14 p.m. OK Python 3 TESTS 14 249 14233600
193357877 eeveeislove C Feb. 12, 2023, 2:31 p.m. OK Python 3 TESTS 14 264 13926400
193333987 fQuark C Feb. 12, 2023, 11:07 a.m. OK Rust 2021 TESTS 14 31 14745600
193402964 togatoga C Feb. 12, 2023, 9:58 p.m. OK Rust 2021 TESTS 14 109 15052800

remove filters

Back to search problems