Codeforces Round 1079 (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
2197 Codeforces Round 1079 (Div. 2) FINISHED False 10800 5585122 Feb. 11, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 15685 ) B Array and Permutation PROGRAMMING implementation sortings two pointers

Given a permutation (p) of length (n)(^{\text{∗}}) and an array (a) of length (n). We call the permutation (p) generating for the array (a) if the array (a) can be obtained from the permutation (p) by applying some number of operations (possibly zero) of the following type: Choose an index (i) ((1 \le i \lt n)) and perform one of two replacements: (p_{i} := p_{i + 1}); (p_{i + 1} := p_{i}). In other words, in one operation, you can choose two adjacent elements of the array and copy the value of one into the other. You are required to report whether the permutation (p) is generating for the array (a). (^{\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). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 2 \cdot 10^{5})) — the length of the array and the permutation. The second line of each test case contains (n) integers (p_1, p_2, \ldots, p_n) ((1 \le p_{i} \le n)) — the elements of the permutation. The third line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_{i} \le n)) — the elements of the array. It is guaranteed that the sum of (n) across all test cases does not exceed (2 \cdot 10^{5}). For each test case, output " YES " if the permutation (p) is generating for the array (a), otherwise output " NO ". You may output each letter in any case (lowercase or uppercase). For example, the strings " yEs ", " yes ", " Yes ", and " YES "

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
362520303 Ashu1007 B Feb. 11, 2026, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 10 78 0
362554876 LovingHusband B Feb. 11, 2026, 10:31 p.m. OK C++17 (GCC 7-32) TESTS 10 78 0
362556448 harley.caio B Feb. 11, 2026, 11:12 p.m. OK C++17 (GCC 7-32) TESTS 10 78 102400
362560518 LK_Bocchi_Rikka B Feb. 12, 2026, 1:08 a.m. OK C++17 (GCC 7-32) TESTS 10 78 102400
362574706 Shawn_das B Feb. 12, 2026, 5:08 a.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362568195 dan__chou B Feb. 12, 2026, 3:46 a.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362569263 akhil_8289 B Feb. 12, 2026, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362554138 Avneesh_4647 B Feb. 11, 2026, 10:16 p.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362536432 zeyrugan B Feb. 11, 2026, 6:48 p.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362579456 sao8 B Feb. 12, 2026, 6:02 a.m. OK C++17 (GCC 7-32) TESTS 10 93 0
362570021 RFT_SIRM B Feb. 12, 2026, 4:06 a.m. OK C++20 (GCC 13-64) TESTS 10 78 0
362525352 Mptf B Feb. 11, 2026, 5:29 p.m. OK C++20 (GCC 13-64) TESTS 10 78 0
362548986 Unbounded B Feb. 11, 2026, 8:52 p.m. OK C++20 (GCC 13-64) TESTS 10 78 0
362573389 aryan96636 B Feb. 12, 2026, 4:53 a.m. OK C++20 (GCC 13-64) TESTS 10 78 0
362560163 Nghich_Thien B Feb. 12, 2026, 12:58 a.m. OK C++20 (GCC 13-64) TESTS 10 78 0
362524016 Jaszstat B Feb. 11, 2026, 5:26 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
362561375 mazenqwe3473062005 B Feb. 12, 2026, 1:31 a.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
362553399 sqrt73 B Feb. 11, 2026, 10:01 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
362536721 fayoor B Feb. 11, 2026, 6:50 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
362563024 ZengZhaoGan_124 B Feb. 12, 2026, 2:10 a.m. OK C++20 (GCC 13-64) TESTS 10 78 921600
362561573 Laoxu0919 B Feb. 12, 2026, 1:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 4300800
362549953 Shivanshu_9 B Feb. 11, 2026, 9:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 102400
362554441 rabinkarp B Feb. 11, 2026, 10:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362557168 shreyash700 B Feb. 11, 2026, 11:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362552024 fuad_01123 B Feb. 11, 2026, 9:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362579904 ok232 B Feb. 12, 2026, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362573532 Link__ B Feb. 12, 2026, 4:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362571737 theflyingdutchman1 B Feb. 12, 2026, 4:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362563643 hguanc B Feb. 12, 2026, 2:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362561330 Vamsi_Yerupalle B Feb. 12, 2026, 1:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 78 0
362567989 liuQiee B Feb. 12, 2026, 3:43 a.m. OK GNU C11 TESTS 10 62 3276800
362526751 m0r7al B Feb. 11, 2026, 5:31 p.m. OK GNU C11 TESTS 10 93 1536000
362570721 Praneel_513 B Feb. 12, 2026, 4:15 a.m. OK GNU C11 TESTS 10 93 2355200
362536910 uvwxz B Feb. 11, 2026, 6:52 p.m. OK Go TESTS 10 796 7782400
362526324 punitpunde B Feb. 11, 2026, 5:30 p.m. OK Java 21 TESTS 10 218 204800
362554812 ankush_23b B Feb. 11, 2026, 10:30 p.m. OK Java 21 TESTS 10 218 512000
362523039 Shreyas3406 B Feb. 11, 2026, 5:24 p.m. OK Java 21 TESTS 10 265 5120000
362542551 jaysuryaray1998 B Feb. 11, 2026, 7:37 p.m. OK Java 21 TESTS 10 281 2560000
362556986 sathwikhbhat B Feb. 11, 2026, 11:29 p.m. OK Java 21 TESTS 10 281 4198400
362522269 aryancodealchemy26 B Feb. 11, 2026, 5:22 p.m. OK Java 21 TESTS 10 296 512000
362525575 cl60 B Feb. 11, 2026, 5:29 p.m. OK Java 21 TESTS 10 296 2764800
362561546 xpnsn B Feb. 12, 2026, 1:35 a.m. OK Java 21 TESTS 10 296 2764800
362518942 ygfchatse B Feb. 11, 2026, 5:15 p.m. OK Java 21 TESTS 10 328 20582400
362564671 Sagar_TH_45 B Feb. 12, 2026, 2:45 a.m. OK Java 21 TESTS 10 343 2252800
362565964 kevin_0911 B Feb. 12, 2026, 3:09 a.m. OK Java 8 TESTS 10 171 6348800
362563266 abhishek1445 B Feb. 12, 2026, 2:16 a.m. OK Java 8 TESTS 10 546 0
362521788 sharma__jii B Feb. 11, 2026, 5:21 p.m. OK Java 8 TESTS 10 562 0
362576532 asrithacherukuri97 B Feb. 12, 2026, 5:30 a.m. OK Java 8 TESTS 10 562 0
362527403 jainnishan B Feb. 11, 2026, 5:32 p.m. OK Java 8 TESTS 10 578 0
362567090 Bharath52 B Feb. 12, 2026, 3:28 a.m. OK Java 8 TESTS 10 593 0
362521338 MondayNightRollins B Feb. 11, 2026, 5:20 p.m. OK Java 8 TESTS 10 609 0
362573637 _kishore_sirikonda_08__ B Feb. 12, 2026, 4:56 a.m. OK Java 8 TESTS 10 687 19251200
362524947 Hallowno4 B Feb. 11, 2026, 5:28 p.m. OK PyPy 3 TESTS 10 328 17920000
362553407 SuryaPrakashMC B Feb. 11, 2026, 10:01 p.m. OK PyPy 3 TESTS 10 328 151961600
362527094 Lakshay_Arya B Feb. 11, 2026, 5:32 p.m. OK PyPy 3 TESTS 10 343 18124800
362545499 myang2111 B Feb. 11, 2026, 8:09 p.m. OK PyPy 3 TESTS 10 343 21504000
362558177 Jhinigami B Feb. 12, 2026, 12:01 a.m. OK PyPy 3 TESTS 10 359 16076800
362545264 masao B Feb. 11, 2026, 8:06 p.m. OK PyPy 3-64 TESTS 10 125 24268800
362522373 kaedeeeee B Feb. 11, 2026, 5:23 p.m. OK PyPy 3-64 TESTS 10 125 24371200
362575779 HumbleRobo B Feb. 12, 2026, 5:21 a.m. OK PyPy 3-64 TESTS 10 125 24883200
362543185 8sunny_sky8 B Feb. 11, 2026, 7:44 p.m. OK PyPy 3-64 TESTS 10 125 30720000
362576424 jvatsal0709 B Feb. 12, 2026, 5:29 a.m. OK PyPy 3-64 TESTS 10 140 23142400
362570790 javoh1964 B Feb. 12, 2026, 4:16 a.m. OK PyPy 3-64 TESTS 10 140 30617600
362518255 sakshatmali B Feb. 11, 2026, 5:14 p.m. OK PyPy 3-64 TESTS 10 140 31539200
362521676 ishitsurana1 B Feb. 11, 2026, 5:21 p.m. OK PyPy 3-64 TESTS 10 140 31948800
362533831 VoidRanger B Feb. 11, 2026, 6:32 p.m. OK PyPy 3-64 TESTS 10 140 32051200
362553667 beansQ B Feb. 11, 2026, 10:07 p.m. OK PyPy 3-64 TESTS 10 140 32460800
362560693 tnwrshubham52 B Feb. 12, 2026, 1:13 a.m. OK Python 2 TESTS 10 328 19046400
362562632 taxir B Feb. 12, 2026, 2 a.m. OK Python 3 TESTS 10 171 31846400
362547648 eugalt B Feb. 11, 2026, 8:34 p.m. OK Python 3 TESTS 10 171 33894400
362548126 eugalt B Feb. 11, 2026, 8:41 p.m. OK Python 3 TESTS 10 171 35430400
362541071 M.Campver B Feb. 11, 2026, 7:24 p.m. OK Python 3 TESTS 10 187 48742400
362527300 Yostina_Abera B Feb. 11, 2026, 5:32 p.m. OK Python 3 TESTS 10 203 36864000
362522271 eugalt B Feb. 11, 2026, 5:22 p.m. OK Python 3 TESTS 10 218 30515200
362556904 riaz2001 B Feb. 11, 2026, 11:26 p.m. OK Python 3 TESTS 10 218 38707200
362525029 eyk B Feb. 11, 2026, 5:28 p.m. OK Python 3 TESTS 10 218 38707200
362570749 ecubic B Feb. 12, 2026, 4:15 a.m. OK Python 3 TESTS 10 218 38707200
362566469 JWenBo B Feb. 12, 2026, 3:18 a.m. OK Python 3 TESTS 10 218 40345600
362566568 Singu_Larity B Feb. 12, 2026, 3:19 a.m. OK Rust 2024 TESTS 10 46 6144000

remove filters

Back to search problems