Codeforces Round 979 (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
2030 Codeforces Round 979 (Div. 2) FINISHED False 8100 47058923 Oct. 19, 2024, 2:05 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 8574 ) D QED's Favorite Permutation PROGRAMMING bitmasks data structures implementation sortings

QED is given a permutation(^{\text{∗}}) (p) of length (n). He also has a string (s) of length (n) containing only characters (L) and (R). QED only likes permutations that are sorted in non-decreasing order. To sort (p), he can select any of the following operations and perform them any number of times: Choose an index (i) such that (s_i = L). Then, swap (p_i) and (p_{i-1}). It is guaranteed that (s_1 \neq L). Choose an index (i) such that (s_i = R). Then, swap (p_i) and (p_{i+1}). It is guaranteed that (s_n \neq R). He is also given (q) queries. In each query, he selects an index (i) and changes (s_i) from (L) to (R) (or from (R) to (L)). Note that the changes are persistent . After each query, he asks you if it is possible to sort (p) in non-decreasing order by performing the aforementioned operations any number of times. Note that before answering each query, the permutation (p) is reset to its original form. (^{\text{∗}})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). The first line contains (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains two integers (n) and (q) ((3 \leq n \leq 2 \cdot 10^5), (1 \leq q \leq 2 \cdot 10^5)) – the length of the permutation and the number of queries. The following line contains (n) integers (p_1, p_2, \ldots, p_n) ((1 \leq p_i \leq n), (p) is a permutation). The following line contains (n) characters (s_1s_2 \ldots s_n). It is guaranteed

Tutorials

Codeforces Round 979 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
286843742 AIM1rage D Oct. 19, 2024, 7:54 p.m. OK C# 10 TESTS 26 421 33894400
286869623 yumingsk D Oct. 20, 2024, 4:23 a.m. OK C++17 (GCC 7-32) TESTS 26 140 102400
286863655 ITIS_Code D Oct. 20, 2024, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 26 140 102400
286861803 YassaTalaat D Oct. 20, 2024, 2:22 a.m. OK C++17 (GCC 7-32) TESTS 26 140 102400
286838399 Kener_Castillo D Oct. 19, 2024, 6:56 p.m. OK C++17 (GCC 7-32) TESTS 26 140 102400
286875021 xuangou D Oct. 20, 2024, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 26 140 204800
286868069 adityaabhilash D Oct. 20, 2024, 4:04 a.m. OK C++17 (GCC 7-32) TESTS 26 140 1331200
286864376 lnu20231497317 D Oct. 20, 2024, 3:09 a.m. OK C++17 (GCC 7-32) TESTS 26 140 1740800
286862547 chaoslong D Oct. 20, 2024, 2:37 a.m. OK C++17 (GCC 7-32) TESTS 26 140 2048000
286811045 Isekai_MC D Oct. 19, 2024, 4:02 p.m. OK C++17 (GCC 7-32) TESTS 26 140 2048000
286830744 Ayman_Elkilany D Oct. 19, 2024, 5:55 p.m. OK C++17 (GCC 7-32) TESTS 26 140 3686400
286865337 The-homeless D Oct. 20, 2024, 3:24 a.m. OK C++20 (GCC 13-64) TESTS 26 109 102400
286857929 i_liek_cheezits D Oct. 20, 2024, 12:44 a.m. OK C++20 (GCC 13-64) TESTS 26 109 102400
286856847 rhizome-yanhe D Oct. 20, 2024, 12:04 a.m. OK C++20 (GCC 13-64) TESTS 26 109 102400
286864067 sudharshan281 D Oct. 20, 2024, 3:04 a.m. OK C++20 (GCC 13-64) TESTS 26 109 2150400
286877130 jzcrq D Oct. 20, 2024, 5:42 a.m. OK C++20 (GCC 13-64) TESTS 26 109 2969600
286858120 ChaosReasonOne D Oct. 20, 2024, 12:50 a.m. OK C++20 (GCC 13-64) TESTS 26 109 2969600
286858441 shucshin D Oct. 20, 2024, 1 a.m. OK C++20 (GCC 13-64) TESTS 26 109 3788800
286862200 zrj66 D Oct. 20, 2024, 2:30 a.m. OK C++20 (GCC 13-64) TESTS 26 109 16691200
286879933 DrShivam2004 D Oct. 20, 2024, 6:04 a.m. OK C++20 (GCC 13-64) TESTS 26 124 102400
286878114 msiad D Oct. 20, 2024, 5:50 a.m. OK C++20 (GCC 13-64) TESTS 26 124 102400
286859553 whiliam D Oct. 20, 2024, 1:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 109 307200
286878104 _Equinox D Oct. 20, 2024, 5:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 102400
286839059 Aspirebugs D Oct. 19, 2024, 7:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 102400
286838005 ipy_ D Oct. 19, 2024, 6:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 102400
286837970 do0ola D Oct. 19, 2024, 6:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 102400
286831427 bera_474 D Oct. 19, 2024, 6 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 102400
286840004 Ruthless__ D Oct. 19, 2024, 7:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 124 3072000
286864817 nyavim D Oct. 20, 2024, 3:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 125 204800
286861742 BiggestOtaku D Oct. 20, 2024, 2:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 125 2355200
286844172 Remgagagali727 D Oct. 19, 2024, 7:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 139 102400
286838889 gxlois D Oct. 19, 2024, 7:01 p.m. OK D TESTS 26 265 10444800
286811876 Alyyys D Oct. 19, 2024, 4:04 p.m. OK GNU C11 TESTS 26 202 1843200
286874824 amit_roy D Oct. 20, 2024, 5:22 a.m. OK Java 21 TESTS 26 359 6041600
286844603 prohladenn_vko D Oct. 19, 2024, 8:04 p.m. OK Java 21 TESTS 26 390 716800
286814919 Lipind D Oct. 19, 2024, 4:12 p.m. OK Java 21 TESTS 26 405 3379200
286823650 Orange905 D Oct. 19, 2024, 5:13 p.m. OK Java 21 TESTS 26 406 18739200
286845246 vatsal_04 D Oct. 19, 2024, 8:12 p.m. OK Java 21 TESTS 26 452 1638400
286833207 GaleStarr D Oct. 19, 2024, 6:14 p.m. OK Java 21 TESTS 26 499 9625600
286839122 dineshchandran311 D Oct. 19, 2024, 7:04 p.m. OK Java 21 TESTS 26 515 12595200
286845197 sharmanitin5114 D Oct. 19, 2024, 8:12 p.m. OK Java 21 TESTS 26 515 16793600
286867837 man-ray D Oct. 20, 2024, 4:01 a.m. OK Java 21 TESTS 26 530 14950400
286869453 InfinityX D Oct. 20, 2024, 4:22 a.m. OK Java 21 TESTS 26 577 5836800
286837665 redreoicy D Oct. 19, 2024, 6:49 p.m. OK Java 8 TESTS 26 265 3686400
286817922 NisargPat D Oct. 19, 2024, 4:18 p.m. OK Java 8 TESTS 26 374 6758400
286813117 mohit458 D Oct. 19, 2024, 4:07 p.m. OK Java 8 TESTS 26 796 16486400
286877512 kasiru_69 D Oct. 20, 2024, 5:45 a.m. OK Java 8 TESTS 26 874 3891200
286815280 saurabhs1206 D Oct. 19, 2024, 4:13 p.m. OK Java 8 TESTS 26 1014 73216000
286843151 TitTolkachev D Oct. 19, 2024, 7:47 p.m. OK Kotlin 1.9 TESTS 26 374 16076800
286812615 WbxOne D Oct. 19, 2024, 4:06 p.m. OK Node.js TESTS 26 827 100352000
286865798 gaidash D Oct. 20, 2024, 3:31 a.m. OK PyPy 3-64 TESTS 26 359 40652800
286859333 Haksell D Oct. 20, 2024, 1:26 a.m. OK PyPy 3-64 TESTS 26 374 29081600
286876116 tlsgusrb314 D Oct. 20, 2024, 5:33 a.m. OK PyPy 3-64 TESTS 26 437 34611200
286831717 gardengnome D Oct. 19, 2024, 6:02 p.m. OK PyPy 3-64 TESTS 26 452 23347200
286828004 Monocrap D Oct. 19, 2024, 5:36 p.m. OK PyPy 3-64 TESTS 26 468 26009600
286835733 balalm10 D Oct. 19, 2024, 6:33 p.m. OK PyPy 3-64 TESTS 26 484 39116800
286844043 Shaydiesin D Oct. 19, 2024, 7:57 p.m. OK PyPy 3-64 TESTS 26 499 32563200
286830028 Monocrap D Oct. 19, 2024, 5:50 p.m. OK PyPy 3-64 TESTS 26 515 26112000
286836918 balalm10 D Oct. 19, 2024, 6:43 p.m. OK PyPy 3-64 TESTS 26 515 39731200
286838825 cecilia.chan D Oct. 19, 2024, 7:01 p.m. OK PyPy 3-64 TESTS 26 515 46694400
286852608 gafgadfdfvswe D Oct. 19, 2024, 10:03 p.m. OK Python 3 TESTS 26 687 25600000
286871672 chughtaisaeed D Oct. 20, 2024, 4:48 a.m. OK Python 3 TESTS 26 718 25600000
286857727 dhruv10 D Oct. 20, 2024, 12:37 a.m. OK Python 3 TESTS 26 733 29388800
286852550 gafgadfdfvswe D Oct. 19, 2024, 10:02 p.m. OK Python 3 TESTS 26 781 25907200
286857444 dhruv10 D Oct. 20, 2024, 12:27 a.m. OK Python 3 TESTS 26 1109 27852800
286833425 devineni_b220257cs D Oct. 19, 2024, 6:15 p.m. OK Python 3 TESTS 26 1124 27340800
286816682 immortal2121 D Oct. 19, 2024, 4:16 p.m. OK Python 3 TESTS 26 1124 27340800
286823363 surajajaydwivedi D Oct. 19, 2024, 5:11 p.m. OK Python 3 TESTS 26 1343 31232000
286813272 Akshar_7 D Oct. 19, 2024, 4:08 p.m. OK Python 3 TESTS 26 1453 39321600
286826904 upkl D Oct. 19, 2024, 5:31 p.m. OK Ruby 3 TESTS 26 968 53862400
286848538 gmm_tea D Oct. 19, 2024, 8:54 p.m. OK Ruby 3 TESTS 26 1030 58777600
286815318 upkl D Oct. 19, 2024, 4:13 p.m. OK Ruby 3 TESTS 26 1171 66969600
286846964 PaciukZvichainyi D Oct. 19, 2024, 8:34 p.m. OK Rust 2021 TESTS 26 389 58880000
286813797 ChristopherDaley D Oct. 19, 2024, 4:09 p.m. OK Rust 2021 TESTS 26 530 1945600

remove filters

Back to search problems