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 |
---|---|---|---|---|---|---|
1793 | Codeforces Round 852 (Div. 2) | FINISHED | False | 7200 | 61075463 | Feb. 12, 2023, 8:35 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 6379 ) | D | Moscow Gorillas | PROGRAMMING | dp greedy implementation two pointers |
B"In winter, the inhabitants of the Moscow Zoo are very bored, in particular, it concerns gorillas. You decided to entertain them and brought a permutation p of length n to the zoo. A permutation of length n is an array consisting of n distinct integers from 1 to n in any order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 occurs twice in the array) and [1,3,4] is also not a permutation ( n=3 , but 4 is present in the array). The gorillas had their own permutation q of length n . They suggested that you count the number of pairs of integers l, r ( 1 <= l <= r <= n ) such that operatorname{MEX}([p_l, p_{l+1}, ldots, p_r])= operatorname{MEX}([q_l, q_{l+1}, ldots, q_r]) . The operatorname{MEX} of the sequence is the minimum integer positive number missing from this sequence. For example, operatorname{MEX}([1, 3]) = 2 , operatorname{MEX}([5]) = 1 , operatorname{MEX}([3, 1, 2, 6]) = 4 . You do not want to risk your health, so you will not dare to refuse the gorillas. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the permutations length. The second line contains n integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ) -- the elements of the permutation p . The third line contains n integers q_1, q_2, ldots, q_n ( 1 <= q_i <= n ) -- the elements of the permutation q . Print a single integer -- the number of suitable pairs l and r . In the first example, two segments are correct xe2 x80 x93 [1, 3] with operatorname{MEX} equal to 4 in both arrays and [3, 3] with operatorname{MEX} equal to 1 in both of arrays. In the second example, for example, the segment [1, 4] is correct, and the segment [6, 7] isn't correct, because operatorname{MEX}(5, 4) neq operatorname{MEX}"... |
Codeforces Round #852 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
193416595 | Joe_yue6 | D | Feb. 13, 2023, 3:47 a.m. | OK | Clang++20 Diagnostics | TESTS | 73 | 1419 | 3993600 | ||
193358175 | ruban | D | Feb. 12, 2023, 2:33 p.m. | OK | Delphi | TESTS | 73 | 109 | 109158400 | ||
193334581 | tokitsukaze | D | Feb. 12, 2023, 11:12 a.m. | OK | GNU C++14 | TESTS | 73 | 31 | 4915200 | ||
193409670 | CE_automata | D | Feb. 13, 2023, 12:44 a.m. | OK | GNU C++14 | TESTS | 73 | 31 | 6553600 | ||
193415912 | extreme1228 | D | Feb. 13, 2023, 3:33 a.m. | OK | GNU C++14 | TESTS | 73 | 93 | 1638400 | ||
193413474 | JoesSR | D | Feb. 13, 2023, 2:34 a.m. | OK | GNU C++14 | TESTS | 73 | 93 | 3174400 | ||
193411259 | liyipeng | D | Feb. 13, 2023, 1:33 a.m. | OK | GNU C++14 | TESTS | 73 | 93 | 3174400 | ||
193338559 | Cu_OH_2 | D | Feb. 12, 2023, 11:42 a.m. | OK | GNU C++14 | TESTS | 73 | 93 | 3174400 | ||
193416541 | 2745518585 | D | Feb. 13, 2023, 3:46 a.m. | OK | GNU C++14 | TESTS | 73 | 93 | 15974400 | ||
193423250 | aryan_sehgal | D | Feb. 13, 2023, 5:53 a.m. | OK | GNU C++14 | TESTS | 73 | 108 | 3174400 | ||
193356360 | learner_RR | D | Feb. 12, 2023, 2:18 p.m. | OK | GNU C++14 | TESTS | 73 | 108 | 3174400 | ||
193386403 | iamattri0001 | D | Feb. 12, 2023, 6:34 p.m. | OK | GNU C++14 | TESTS | 73 | 109 | 1638400 | ||
193410483 | magnickolas | D | Feb. 13, 2023, 1:09 a.m. | OK | GNU C++17 | TESTS | 73 | 30 | 3276800 | ||
193411080 | magnickolas | D | Feb. 13, 2023, 1:27 a.m. | OK | GNU C++17 | TESTS | 73 | 31 | 3276800 | ||
193410333 | magnickolas | D | Feb. 13, 2023, 1:04 a.m. | OK | GNU C++17 | TESTS | 73 | 31 | 3276800 | ||
193386999 | dmenezes | D | Feb. 12, 2023, 6:39 p.m. | OK | GNU C++17 | TESTS | 73 | 46 | 24883200 | ||
193418421 | PrafulSinghal | D | Feb. 13, 2023, 4:28 a.m. | OK | GNU C++17 | TESTS | 73 | 108 | 1638400 | ||
193358613 | aaryaag03 | D | Feb. 12, 2023, 2:37 p.m. | OK | GNU C++17 | TESTS | 73 | 108 | 3174400 | ||
193346853 | Hassn_Hamada | D | Feb. 12, 2023, 12:57 p.m. | OK | GNU C++17 | TESTS | 73 | 108 | 3481600 | ||
193420451 | occj | D | Feb. 13, 2023, 5:06 a.m. | OK | GNU C++17 | TESTS | 73 | 109 | 1638400 | ||
193413811 | lniiwuw_y | D | Feb. 13, 2023, 2:40 a.m. | OK | GNU C++17 | TESTS | 73 | 109 | 1638400 | ||
193410327 | mayank_k2 | D | Feb. 13, 2023, 1:04 a.m. | OK | GNU C++17 | TESTS | 73 | 109 | 1638400 | ||
193416638 | Remilia1023 | D | Feb. 13, 2023, 3:48 a.m. | OK | GNU C++17 (64) | TESTS | 73 | 31 | 5324800 | ||
193344358 | xyl1234 | D | Feb. 12, 2023, 12:34 p.m. | OK | GNU C++17 (64) | TESTS | 73 | 31 | 16076800 | ||
193335193 | alif_cse_ju | D | Feb. 12, 2023, 11:15 a.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 1638400 | ||
193378274 | tanishparmar | D | Feb. 12, 2023, 5:24 p.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 3174400 | ||
193368089 | Hashira | D | Feb. 12, 2023, 3:59 p.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 3174400 | ||
193345090 | T0uRistq | D | Feb. 12, 2023, 12:41 p.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 3276800 | ||
193334613 | deepak_sriram | D | Feb. 12, 2023, 11:12 a.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 3276800 | ||
193409191 | Kicamon | D | Feb. 13, 2023, 12:32 a.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 6451200 | ||
193392731 | MarcosK | D | Feb. 12, 2023, 7:38 p.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 6451200 | ||
193338118 | narrowkind | D | Feb. 12, 2023, 11:38 a.m. | OK | GNU C++17 (64) | TESTS | 73 | 62 | 6656000 | ||
193394072 | tredsused70 | D | Feb. 12, 2023, 7:53 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 31 | 6348800 | ||
193391990 | tredsused70 | D | Feb. 12, 2023, 7:30 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 31 | 7884800 | ||
193336001 | threethreetwothree | D | Feb. 12, 2023, 11:21 a.m. | OK | GNU C++20 (64) | TESTS | 73 | 31 | 12390400 | ||
193342131 | Im70tep | D | Feb. 12, 2023, 12:13 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 46 | 3174400 | ||
193340397 | beot | D | Feb. 12, 2023, 11:57 a.m. | OK | GNU C++20 (64) | TESTS | 73 | 46 | 3174400 | ||
193407896 | mQfZ | D | Feb. 12, 2023, 11:53 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 46 | 3276800 | ||
193412158 | Tawes | D | Feb. 13, 2023, 2:01 a.m. | OK | GNU C++20 (64) | TESTS | 73 | 62 | 1638400 | ||
193411887 | Gamal74 | D | Feb. 13, 2023, 1:53 a.m. | OK | GNU C++20 (64) | TESTS | 73 | 62 | 1638400 | ||
193407289 | A_G | D | Feb. 12, 2023, 11:36 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 62 | 1638400 | ||
193406295 | Awesome3.14 | D | Feb. 12, 2023, 11:11 p.m. | OK | GNU C++20 (64) | TESTS | 73 | 62 | 1638400 | ||
193333498 | arun07 | D | Feb. 12, 2023, 11:05 a.m. | OK | Go | TESTS | 73 | 202 | 8396800 | ||
193333998 | WORTH | D | Feb. 12, 2023, 11:07 a.m. | OK | Java 11 | TESTS | 73 | 218 | 0 | ||
193334257 | dzhi | D | Feb. 12, 2023, 11:09 a.m. | OK | Java 11 | TESTS | 73 | 280 | 37990400 | ||
193333314 | dzhi | D | Feb. 12, 2023, 11:05 a.m. | OK | Java 11 | TESTS | 73 | 295 | 34816000 | ||
193336985 | Ramez__ | D | Feb. 12, 2023, 11:28 a.m. | OK | Java 11 | TESTS | 73 | 482 | 44953600 | ||
193331172 | dajeff | D | Feb. 12, 2023, 10:34 a.m. | OK | Java 11 | TESTS | 73 | 576 | 38604800 | ||
193333605 | leoncn | D | Feb. 12, 2023, 11:05 a.m. | OK | Java 11 | TESTS | 73 | 623 | 35737600 | ||
193375219 | Hiranmoy | D | Feb. 12, 2023, 4:59 p.m. | OK | Java 17 | TESTS | 73 | 295 | 12492800 | ||
193354968 | Hiranmoy | D | Feb. 12, 2023, 2:05 p.m. | OK | Java 17 | TESTS | 73 | 764 | 6451200 | ||
193407304 | megaspazz | D | Feb. 12, 2023, 11:36 p.m. | OK | Java 8 | TESTS | 73 | 124 | 0 | ||
193388465 | GR1ZLER | D | Feb. 12, 2023, 6:54 p.m. | OK | Java 8 | TESTS | 73 | 124 | 0 | ||
193347969 | gaju_01 | D | Feb. 12, 2023, 1:06 p.m. | OK | Java 8 | TESTS | 73 | 170 | 0 | ||
193414253 | IanISam | D | Feb. 13, 2023, 2:51 a.m. | OK | Java 8 | TESTS | 73 | 171 | 4608000 | ||
193395027 | Swapniltri | D | Feb. 12, 2023, 8:03 p.m. | OK | Java 8 | TESTS | 73 | 186 | 7884800 | ||
193417234 | lpychemistry | D | Feb. 13, 2023, 4:03 a.m. | OK | Java 8 | TESTS | 73 | 187 | 7884800 | ||
193329742 | 2023_upsolver | D | Feb. 12, 2023, 10:30 a.m. | OK | Java 8 | TESTS | 73 | 187 | 9216000 | ||
193334812 | sachinjaiswal | D | Feb. 12, 2023, 11:13 a.m. | OK | Java 8 | TESTS | 73 | 187 | 10137600 | ||
193331145 | feixiao | D | Feb. 12, 2023, 10:34 a.m. | OK | Java 8 | TESTS | 73 | 249 | 18534400 | ||
193412118 | -crazy_coder- | D | Feb. 13, 2023, 2 a.m. | OK | Java 8 | TESTS | 73 | 280 | 22220800 | ||
193352353 | reosfire | D | Feb. 12, 2023, 1:44 p.m. | OK | Kotlin 1.7 | TESTS | 73 | 811 | 138956800 | ||
193397733 | mark77 | D | Feb. 12, 2023, 8:37 p.m. | OK | MS C++ 2017 | TESTS | 73 | 296 | 3174400 | ||
193343316 | valyanarezka | D | Feb. 12, 2023, 12:25 p.m. | OK | MS C++ 2017 | TESTS | 73 | 343 | 6451200 | ||
193398176 | payday3 | D | Feb. 12, 2023, 8:43 p.m. | OK | MS C++ 2017 | TESTS | 73 | 670 | 12902400 | ||
193396757 | Andy_Huo | D | Feb. 12, 2023, 8:24 p.m. | OK | PyPy 3 | TESTS | 73 | 343 | 19251200 | ||
193421534 | bpdolson | D | Feb. 13, 2023, 5:25 a.m. | OK | PyPy 3 | TESTS | 73 | 405 | 22016000 | ||
193411716 | kdypr | D | Feb. 13, 2023, 1:48 a.m. | OK | PyPy 3 | TESTS | 73 | 451 | 22835200 | ||
193337108 | leehosu01 | D | Feb. 12, 2023, 11:29 a.m. | OK | PyPy 3 | TESTS | 73 | 717 | 64512000 | ||
193348126 | InariInDream | D | Feb. 12, 2023, 1:08 p.m. | OK | PyPy 3-64 | TESTS | 73 | 156 | 39936000 | ||
193358105 | SophieHatter | D | Feb. 12, 2023, 2:33 p.m. | OK | PyPy 3-64 | TESTS | 73 | 156 | 41984000 | ||
193403235 | Remineva | D | Feb. 12, 2023, 10:03 p.m. | OK | PyPy 3-64 | TESTS | 73 | 171 | 30617600 | ||
193349772 | aayush_chhabra | D | Feb. 12, 2023, 1:22 p.m. | OK | PyPy 3-64 | TESTS | 73 | 171 | 32768000 | ||
193341991 | Ayushrusiya47 | D | Feb. 12, 2023, 12:11 p.m. | OK | PyPy 3-64 | TESTS | 73 | 171 | 33792000 | ||
193386291 | abcsumits | D | Feb. 12, 2023, 6:33 p.m. | OK | PyPy 3-64 | TESTS | 73 | 171 | 37785600 | ||
193409971 | Yansou | D | Feb. 13, 2023, 12:54 a.m. | OK | PyPy 3-64 | TESTS | 73 | 171 | 41881600 | ||
193421814 | pitP | D | Feb. 13, 2023, 5:29 a.m. | OK | PyPy 3-64 | TESTS | 73 | 187 | 33792000 | ||
193337925 | 34z12000 | D | Feb. 12, 2023, 11:37 a.m. | OK | PyPy 3-64 | TESTS | 73 | 187 | 33792000 | ||
193330422 | Hyunsung | D | Feb. 12, 2023, 10:32 a.m. | OK | PyPy 3-64 | TESTS | 73 | 187 | 34713600 | ||
193330696 | dqian3 | D | Feb. 12, 2023, 10:33 a.m. | OK | Python 3 | TESTS | 73 | 779 | 17612800 | ||
193337139 | mfeds | D | Feb. 12, 2023, 11:30 a.m. | OK | Rust 2021 | TESTS | 73 | 46 | 10547200 | ||
193336259 | 0npata | D | Feb. 12, 2023, 11:23 a.m. | OK | Rust 2021 | TESTS | 73 | 61 | 6451200 |
Back to search problems