Teza Round 1 (Codeforces Round 1015, 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
2084 Teza Round 1 (Codeforces Round 1015, Div. 1 + Div. 2) FINISHED False 10800 32541923 April 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 505 ) F Skyscape PROGRAMMING constructive algorithms data structures greedy

You are given a permutation (a) of length (n)(^{\text{∗}}). We say that a permutation (b) of length (n) is good if the two permutations (a) and (b) can become the same after performing the following operation at most (n) times (possibly zero): Choose two integers (l, r) such that (1 \le l < r \le n) and (a_r = \min(a_l, a_{l + 1}, \ldots, a_r)). Cyclically shift the subsegment (a_l, a_{l + 1}, \ldots, a_r) one position to the right. In other words, replace (a) with (a_1, \ldots, a_{l - 1}, \; a_r, a_l, a_{l + 1}, \ldots, a_{r - 1}, \; a_{r + 1}, \ldots, a_n). You are also given a permutation (c) of length (n) where some elements are missing and represented by (0). You need to find a good permutation (b_1, b_2, \ldots, b_n) such that (b) can be formed by filling in the missing elements of (c) (i.e., for all (1 \le i \le n), if (c_i \ne 0), then (b_i = c_i)). If it is impossible, output (-1). (^{\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 5 \cdot 10^5)). The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le n)). It is guaranteed that (a) is a permutation of length (n). The third line of each test case contains (n) integers (c_1, c_2, \ldots, c_n) ((0 \le c_i \le n)). It is guaranteed that the elements of (c) that are not (0)

Tutorials

141155

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
314189351 lmh_qwq F April 6, 2025, 3:17 a.m. OK C++17 (GCC 7-32) TESTS 52 405 28672000
314159613 dreamoon_love_AA F April 5, 2025, 6:35 p.m. OK C++17 (GCC 7-32) TESTS 52 421 40243200
314144552 grass8sheep F April 5, 2025, 5:01 p.m. OK C++17 (GCC 7-32) TESTS 52 499 26521600
314145417 Morphed F April 5, 2025, 5:03 p.m. OK C++17 (GCC 7-32) TESTS 52 515 24473600
314146171 Link_Cut_qwq F April 5, 2025, 5:06 p.m. OK C++17 (GCC 7-32) TESTS 52 624 34816000
314191307 lnw143 F April 6, 2025, 3:52 a.m. OK C++17 (GCC 7-32) TESTS 52 1015 19558400
314150868 ian_HLX F April 5, 2025, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 52 1030 52428800
314185848 2021ChengHuaide F April 6, 2025, 2:06 a.m. OK C++17 (GCC 7-32) TESTS 52 1515 214118400
314186570 Sparkle_Twilight F April 6, 2025, 2:21 a.m. OK C++17 (GCC 7-32) TESTS 52 1686 214118400
314165437 abc864197532 F April 5, 2025, 7:27 p.m. OK C++17 (GCC 7-32) TESTS 52 1937 513740800
314191843 2018LZY F April 6, 2025, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 52 375 31744000
314191260 2018LZY F April 6, 2025, 3:51 a.m. OK C++20 (GCC 13-64) TESTS 52 389 31744000
314165900 SinhaSatwik F April 5, 2025, 7:32 p.m. OK C++20 (GCC 13-64) TESTS 52 390 58368000
314142518 RanRankeainie F April 5, 2025, 4:54 p.m. OK C++20 (GCC 13-64) TESTS 52 421 30003200
314161158 A_G F April 5, 2025, 6:48 p.m. OK C++20 (GCC 13-64) TESTS 52 437 36044800
314152041 zdc123456 F April 5, 2025, 5:26 p.m. OK C++20 (GCC 13-64) TESTS 52 452 47718400
314169280 kotatsugame F April 5, 2025, 8:10 p.m. OK C++20 (GCC 13-64) TESTS 52 468 33689600
314162202 LuCpp F April 5, 2025, 6:56 p.m. OK C++20 (GCC 13-64) TESTS 52 483 37785600
314198686 GrandSouris F April 6, 2025, 5:36 a.m. OK C++20 (GCC 13-64) TESTS 52 499 94105600
314162756 arnold518 F April 5, 2025, 7:01 p.m. OK C++20 (GCC 13-64) TESTS 52 562 51507200
314181808 defnotmee F April 6, 2025, 12:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 327 41881600
314181780 defnotmee F April 6, 2025, 12:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 342 42188800
314149117 w4p3r F April 5, 2025, 5:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 343 24678400
314153310 Keshi F April 5, 2025, 5:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 358 38400000
314188202 thanhson0411 F April 6, 2025, 2:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 390 34099200
314148728 Golovanov399 F April 5, 2025, 5:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 405 56627200
314154758 ErrrrrrrayReis37 F April 5, 2025, 5:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 452 35635200
314150674 lmcutezzz F April 5, 2025, 5:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 484 29696000
314149559 duckagainduck F April 5, 2025, 5:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 484 29696000
314153900 Shui_Dream F April 5, 2025, 5:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 499 41779200
314197802 ahmedafeef F April 6, 2025, 5:27 a.m. OK GNU C11 TESTS 52 2296 24166400
314147029 Tier_3_failure F April 5, 2025, 5:09 p.m. OK Java 21 TESTS 52 1921 58982400
314143175 chinerist F April 5, 2025, 4:56 p.m. OK PyPy 3-64 TESTS 52 1499 128102400
314150652 conqueror_of_tourist F April 5, 2025, 5:21 p.m. OK PyPy 3-64 TESTS 52 2265 114892800
314195203 Egor F April 6, 2025, 4:55 a.m. OK Rust 2021 TESTS 52 1046 66969600

remove filters

Back to search problems