Codeforces Round 942 (Div. 1)

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
1967 Codeforces Round 942 (Div. 1) FINISHED False 9000 22692263 April 30, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 700 ) D Long Way to be Non-decreasing PROGRAMMING binary search dfs and similar graphs implementation shortest paths two pointers 2800

B"Little R is a magician who likes non-decreasing arrays. She has an array of length n , initially as a_1, ldots, a_n , in which each element is an integer between [1, m] . She wants it to be non-decreasing, i.e., a_1 <= q a_2 <= q ldots <= q a_n . To do this, she can perform several magic tricks. Little R has a fixed array b_1 ldots b_m of length m . Formally, let's define a trick as a procedure that does the following things in order: Little R wonders how many tricks are needed at least to make the initial array non-decreasing. If it is not possible with any amount of tricks, print -1 instead. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains two integers n and m ( 1 <= q n <= q 10^6 , 1 <= q m <= q 10^6 ) -- the length of the initial array and the range of the elements in the array. The second line of each test case contains n integers a_1, ldots, a_n ( 1 <= q a_i <= q m ) -- the initial array. The third line of each test case contains m integers b_1, ldots, b_m ( 1 <= q b_i <= q m ) -- the fixed magic array. It is guaranteed that the sum of n over all test cases does not exceed 10^6 and the sum of m over all test cases does not exceed 10^6 . For each test case, output a single integer: the minimum number of tricks needed, or -1 if it is impossible to make a_1, ldots, a_n non-decreasing. In the first case, the initial array a_1, ldots, a_n is [1, 6, 3, 7, 1] . You can choose S as follows: In the second case, it is impossible to make a_1, ldots, a_n non-decreasing. "...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260009775 XuYueming D May 8, 2024, 2:01 p.m. OK C++14 (GCC 6-32) TESTS 26 1187 82432000 2800
260106240 for_earth D May 9, 2024, 10:41 a.m. OK C++14 (GCC 6-32) TESTS 26 1562 48742400 2800
259109243 luogu_bot2 D May 2, 2024, 10:47 a.m. OK C++14 (GCC 6-32) TESTS 25 1562 92467200 2800
260007133 XuYueming D May 8, 2024, 1:38 p.m. OK C++14 (GCC 6-32) TESTS 26 1608 82432000 2800
261732164 liyouran D May 20, 2024, 6:50 a.m. OK C++14 (GCC 6-32) TESTS 26 1671 122880000 2800
259109334 luogu_bot5 D May 2, 2024, 10:48 a.m. OK C++14 (GCC 6-32) TESTS 25 1703 92467200 2800
261732249 liyouran D May 20, 2024, 6:51 a.m. OK C++14 (GCC 6-32) TESTS 26 1733 122880000 2800
262883646 RoFtaCD D May 27, 2024, 1 p.m. OK C++14 (GCC 6-32) TESTS 26 1749 92467200 2800
260008025 XuYueming D May 8, 2024, 1:45 p.m. OK C++14 (GCC 6-32) TESTS 26 1764 82432000 2800
261738670 pyiming D May 20, 2024, 7:54 a.m. OK C++14 (GCC 6-32) TESTS 26 1843 117555200 2800
258958734 oceeff D May 1, 2024, 3:52 a.m. OK C++17 (GCC 7-32) TESTS 25 1327 47923200 2800
259070590 oceeff D May 2, 2024, 1:49 a.m. OK C++17 (GCC 7-32) TESTS 25 1374 47923200 2800
260006352 XuYueming D May 8, 2024, 1:32 p.m. OK C++17 (GCC 7-32) TESTS 26 1514 82432000 2800
259973718 XuYueming D May 8, 2024, 8:58 a.m. OK C++17 (GCC 7-32) TESTS 26 1514 101990400 2800
259037503 Layn D May 1, 2024, 5:05 p.m. OK C++17 (GCC 7-32) TESTS 25 1530 77414400 2800
259015463 monstersquq D May 1, 2024, 1:57 p.m. OK C++17 (GCC 7-32) TESTS 25 1639 114380800 2800
262999825 STUDENT0 D May 28, 2024, 11:07 a.m. OK C++17 (GCC 7-32) TESTS 26 1655 118476800 2800
258935308 hos.lyric D April 30, 2024, 7:31 p.m. OK C++17 (GCC 7-32) TESTS 25 1671 86835200 2800
263095873 Joey_c D May 29, 2024, 6:30 a.m. OK C++17 (GCC 7-32) TESTS 26 1686 117350400 2800
259080162 Everule D May 2, 2024, 4:40 a.m. OK C++17 (GCC 7-32) TESTS 25 1702 95129600 2800
258927642 sevlll777 D April 30, 2024, 5:59 p.m. OK C++20 (GCC 13-64) TESTS 25 1249 113561600 2800
258931753 dreamoon_love_AA D April 30, 2024, 6:42 p.m. OK C++20 (GCC 13-64) TESTS 25 1390 114688000 2800
259067614 cmk666 D May 2, 2024, 12:35 a.m. OK C++20 (GCC 13-64) TESTS 25 1405 115712000 2800
258915959 abc864197532 D April 30, 2024, 4:40 p.m. OK C++20 (GCC 13-64) TESTS 24 1468 117555200 2800
258916421 CJ_xde_lt D April 30, 2024, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 24 1483 143974400 2800
262203986 KissaLycoReco D May 23, 2024, 12:38 a.m. OK C++20 (GCC 13-64) TESTS 26 1515 178790400 2800
259291143 luogu_bot3 D May 3, 2024, 3:10 a.m. OK C++20 (GCC 13-64) TESTS 25 1515 184115200 2800
259288122 qiuzx D May 3, 2024, 2:23 a.m. OK C++20 (GCC 13-64) TESTS 25 1515 184115200 2800
258928371 VladProg D April 30, 2024, 6:05 p.m. OK C++20 (GCC 13-64) TESTS 25 1546 138752000 2800
262203964 KissaLycoReco D May 23, 2024, 12:38 a.m. OK C++20 (GCC 13-64) TESTS 26 1546 178790400 2800
258939728 rainboy D April 30, 2024, 8:41 p.m. OK GNU C11 TESTS 25 1999 97075200 2800
259999931 timiss D May 8, 2024, 12:42 p.m. OK GNU C11 TESTS 26 2171 96972800 2800
258947437 DarLam D April 30, 2024, 11:53 p.m. OK Java 21 TESTS 25 3062 152678400 2800
258905442 bruhopen D April 30, 2024, 4:01 p.m. OK Kotlin 1.9 TESTS 24 3671 382259200 2800
259026702 misorin D May 1, 2024, 3:18 p.m. OK PyPy 3-64 TESTS 25 3702 194457600 2800
259026126 misorin D May 1, 2024, 3:12 p.m. OK PyPy 3-64 TESTS 25 3796 194457600 2800
259082505 Little_Sheep_Yawn D May 2, 2024, 5:12 a.m. OK PyPy 3-64 TESTS 25 3874 194457600 2800
259016945 misorin D May 1, 2024, 2:11 p.m. OK PyPy 3-64 TESTS 25 3936 195481600 2800
259025909 misorin D May 1, 2024, 3:10 p.m. OK PyPy 3-64 TESTS 25 3984 194252800 2800
261637012 CAESIUS D May 19, 2024, 10:16 a.m. OK Rust 2021 TESTS 26 2999 285286400 2800
259699175 BetterThanNobita D May 6, 2024, 3:01 a.m. OK Rust 2021 TESTS 25 3327 282214400 2800

remove filters

Back to search problems