Codeforces Round 935 (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
1945 Codeforces Round 935 (Div. 3) FINISHED False 8100 26344463 March 19, 2024, 8:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8506 ) E Binary Search PROGRAMMING binary search constructive algorithms

B'Anton got bored during the hike and wanted to solve something. He asked Kirill if he had any new problems, and of course, Kirill had one. You are given a permutation p of size n , and a number x that needs to be found. A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). You decided that you are a cool programmer, so you will use an advanced algorithm for the search -- binary search. However, you forgot that for binary search, the array must be sorted. You did not give up and decided to apply this algorithm anyway, and in order to get the correct answer, you can perform the following operation no more than 2 times before running the algorithm: choose the indices i , j ( 1 <= i, j <= n ) and swap the elements at positions i and j . After that, the binary search is performed. At the beginning of the algorithm, two variables l = 1 and r = n + 1 are declared. Then the following loop is executed: The goal is to rearrange the numbers in the permutation before the algorithm so that after the algorithm is executed, p_l is equal to x . It can be shown that 2 operations are always sufficient. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then follow the descriptions of the test cases. The first line of each test case contains two integers n and x ( 1 <= x <= n <= 2 cdot 10^5 ) -- the length of the permutation and the number to be found. The second line contains the permutation p separated by spaces ( 1 <= p_i <= n ). It is guaranteed that the sum of the values of '...

Tutorials

127377

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
252392724 skulkers E March 20, 2024, 4:59 a.m. OK C++14 (GCC 6-32) TESTS 14 46 819200
252370281 sstojilkovic19 E March 19, 2024, 10:20 p.m. OK C++14 (GCC 6-32) TESTS 14 46 819200
252367523 God-of-Code E March 19, 2024, 9:38 p.m. OK C++14 (GCC 6-32) TESTS 14 46 819200
252327400 qyz E March 19, 2024, 3:56 p.m. OK C++14 (GCC 6-32) TESTS 14 46 2457600
252334295 XIAOyang4 E March 19, 2024, 4:39 p.m. OK C++14 (GCC 6-32) TESTS 14 46 11980800
252329542 RITU_RAJ_16 E March 19, 2024, 4:08 p.m. OK C++14 (GCC 6-32) TESTS 14 61 819200
252300750 aCssen E March 19, 2024, 1:23 p.m. OK C++14 (GCC 6-32) TESTS 14 61 819200
252383296 lan_10 E March 20, 2024, 2:33 a.m. OK C++14 (GCC 6-32) TESTS 14 61 1638400
252300909 Antonioni E March 19, 2024, 1:24 p.m. OK C++14 (GCC 6-32) TESTS 14 61 1638400
252322422 Kaushal_ism E March 19, 2024, 3:28 p.m. OK C++14 (GCC 6-32) TESTS 14 61 1740800
252336561 SajibKC_19 E March 19, 2024, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 14 31 2355200
252397816 Huangyf E March 20, 2024, 5:56 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252396722 negativeDelta E March 20, 2024, 5:44 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252396210 CCSU_YZT E March 20, 2024, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252394343 Euphoria_07 E March 20, 2024, 5:18 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252393121 nandhagk1729 E March 20, 2024, 5:04 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252392325 Philomath_2723 E March 20, 2024, 4:54 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252387659 Osos_Mo E March 20, 2024, 3:44 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252386469 zhuaiballl E March 20, 2024, 3:26 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252385572 1346266045 E March 20, 2024, 3:12 a.m. OK C++17 (GCC 7-32) TESTS 14 46 819200
252385868 Marckess E March 20, 2024, 3:17 a.m. OK C++20 (GCC 13-64) TESTS 14 31 819200
252370848 zxcuser2 E March 19, 2024, 10:29 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252369974 gbula E March 19, 2024, 10:14 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252350385 lIlIIllIlIIllIlII E March 19, 2024, 6:37 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252349398 lIlIIllIlIIllIlII E March 19, 2024, 6:28 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252310568 Travelerrrr E March 19, 2024, 2:19 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252331869 dreamoon_love_AA E March 19, 2024, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 14 31 2150400
252375503 Mysterious109 E March 20, 2024, 12:03 a.m. OK C++20 (GCC 13-64) TESTS 14 31 4812800
252374679 Mysterious109 E March 19, 2024, 11:45 p.m. OK C++20 (GCC 13-64) TESTS 14 31 4812800
252375856 battledragon E March 20, 2024, 12:10 a.m. OK C++20 (GCC 13-64) TESTS 14 46 819200
252341503 1435730 E March 19, 2024, 5:29 p.m. OK GNU C11 TESTS 14 202 1024000
252305601 Istiyak1264 E March 19, 2024, 1:50 p.m. OK GNU C11 TESTS 14 249 2662400
252323623 E.M.T. E March 19, 2024, 3:35 p.m. OK Go TESTS 14 108 5939200
252345737 RiceTofu E March 19, 2024, 6 p.m. OK Java 21 TESTS 14 280 307200
252398110 amit_roy E March 20, 2024, 5:59 a.m. OK Java 21 TESTS 14 295 204800
252331932 priyaroy3370 E March 19, 2024, 4:23 p.m. OK Java 21 TESTS 14 311 0
252382377 Zhanzhe_Lee E March 20, 2024, 2:18 a.m. OK Java 21 TESTS 14 311 204800
252363831 Sagy13 E March 19, 2024, 8:54 p.m. OK Java 21 TESTS 14 327 204800
252319773 yang_wei E March 19, 2024, 3:12 p.m. OK Java 21 TESTS 14 342 204800
252339701 mohit1510 E March 19, 2024, 5:16 p.m. OK Java 21 TESTS 14 358 409600
252302773 AKhacks E March 19, 2024, 1:34 p.m. OK Java 21 TESTS 14 514 204800
252391667 ayushjaiz E March 20, 2024, 4:46 a.m. OK Java 21 TESTS 14 685 716800
252305967 VivekShah02 E March 19, 2024, 1:52 p.m. OK Java 21 TESTS 14 686 1024000
252316105 leoncn E March 19, 2024, 2:51 p.m. OK Java 8 TESTS 14 109 0
252336546 Yousef_Badr E March 19, 2024, 4:54 p.m. OK Java 8 TESTS 14 124 1843200
252317832 optimus1369 E March 19, 2024, 3:01 p.m. OK Java 8 TESTS 14 139 2150400
252318196 optimus1369 E March 19, 2024, 3:04 p.m. OK Java 8 TESTS 14 140 2048000
252336726 Yousef_Badr E March 19, 2024, 4:56 p.m. OK Java 8 TESTS 14 155 1843200
252319887 optimus1369 E March 19, 2024, 3:13 p.m. OK Java 8 TESTS 14 155 1945600
252330573 YeMengLiChou E March 19, 2024, 4:15 p.m. OK Java 8 TESTS 14 155 5734400
252331945 Pranav_Sharda E March 19, 2024, 4:23 p.m. OK Java 8 TESTS 14 156 2252800
252323109 YeMengLiChou E March 19, 2024, 3:32 p.m. OK Java 8 TESTS 14 156 5734400
252372795 etian6795 E March 19, 2024, 11:06 p.m. OK Java 8 TESTS 14 171 2662400
252378319 YMSeah E March 20, 2024, 1:02 a.m. OK PyPy 3 TESTS 14 155 15564800
252356849 vishruth_21 E March 19, 2024, 7:37 p.m. OK PyPy 3 TESTS 14 607 13516800
252368998 EvGen1u5 E March 19, 2024, 9:59 p.m. OK PyPy 3 TESTS 14 607 13619200
252356467 vishruth_21 E March 19, 2024, 7:33 p.m. OK PyPy 3 TESTS 14 623 13516800
252377107 rhymehatch E March 20, 2024, 12:37 a.m. OK PyPy 3-64 TESTS 14 140 20889600
252378352 smilences E March 20, 2024, 1:02 a.m. OK PyPy 3-64 TESTS 14 155 19968000
252321639 bumsoo0515 E March 19, 2024, 3:23 p.m. OK PyPy 3-64 TESTS 14 155 19968000
252380784 smilences E March 20, 2024, 1:49 a.m. OK PyPy 3-64 TESTS 14 155 22220800
252371110 DRDIV E March 19, 2024, 10:34 p.m. OK PyPy 3-64 TESTS 14 171 21094400
252357211 iN_siDious E March 19, 2024, 7:40 p.m. OK PyPy 3-64 TESTS 14 171 22732800
252333929 arurocks E March 19, 2024, 4:36 p.m. OK PyPy 3-64 TESTS 14 186 19968000
252372032 daszybak E March 19, 2024, 10:52 p.m. OK PyPy 3-64 TESTS 14 187 19763200
252371801 MassimoG E March 19, 2024, 10:48 p.m. OK PyPy 3-64 TESTS 14 202 19660800
252341668 gardengnome E March 19, 2024, 5:30 p.m. OK PyPy 3-64 TESTS 14 202 22630400
252315807 s2110676154 E March 19, 2024, 2:50 p.m. OK Python 3 TESTS 14 171 33689600
252333283 22H51A6762-Manikanta E March 19, 2024, 4:32 p.m. OK Python 3 TESTS 14 218 27955200
252301297 100987654321 E March 19, 2024, 1:26 p.m. OK Python 3 TESTS 14 218 27955200
252337601 rishitha_12 E March 19, 2024, 5:02 p.m. OK Python 3 TESTS 14 264 27852800
252309958 krism E March 19, 2024, 2:15 p.m. OK Python 3 TESTS 14 265 28057600
252308458 lucnguyen030608 E March 19, 2024, 2:07 p.m. OK Python 3 TESTS 14 280 27852800
252342200 tootwp E March 19, 2024, 5:34 p.m. OK Python 3 TESTS 14 296 27136000
252365150 noahhb E March 19, 2024, 9:09 p.m. OK Python 3 TESTS 14 374 29491200
252308379 robostac E March 19, 2024, 2:06 p.m. OK Rust 2021 TESTS 14 15 6860800

remove filters

Back to search problems