Codeforces Round 936 (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
1946 Codeforces Round 936 (Div. 2) FINISHED False 7200 26061863 March 22, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2652 ) E Girl Permutation PROGRAMMING combinatorics dp math number theory

B'Some permutation of length n is guessed. You are given the indices of its prefix maximums and suffix maximums. Recall that a permutation of length k is an array of size k such that each integer from 1 to k occurs exactly once. Prefix maximums are the elements that are the maximum on the prefix ending at that element. More formally, the element a_i is a prefix maximum if a_i > a_j for every j < i . Similarly, suffix maximums are defined, the element a_i is a suffix maximum if a_i > a_j for every j > i . You need to output the number of different permutations that could have been guessed. As this number can be very large, output the answer modulo 10^9 + 7 . Each test consists of several test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follows the description of the test cases. The first line of each test case contains three integers n, m_1 and m_2 ( 1 <= m_1, m_2 <= n <= 2 cdot 10^5 ) -- the length of the permutation, the number of prefix maximums, and the number of suffix maximums, respectively. The second line of each test case contains m_1 integers p_1 < p_2 < ldots < p_{m_1} ( 1 <= p_i <= n ) -- the indices of the prefix maximums in increasing order. The third line of each test case contains m_2 integers s_1 < s_2 < ldots < s_{m_2} ( 1 <= s_i <= n ) -- the indices of the suffix maximums in increasing order. It is guaranteed that the sum of the values of n for all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer on a separate line -- the number of suitable permutations modulo 10^9 + 7 . The following permutations are suitable for the second set of input data: The following permutations are suitable for the sixth set of input data: '...

Tutorials

Codeforces Round #936 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
252812173 kafamcokkaristi E March 22, 2024, 5:29 p.m. OK C++14 (GCC 6-32) TESTS 41 62 3584000
252860051 yeminghan E March 23, 2024, 4:06 a.m. OK C++14 (GCC 6-32) TESTS 41 77 3174400
252800041 xcc_szy09051 E March 22, 2024, 4:17 p.m. OK C++14 (GCC 6-32) TESTS 41 77 7270400
252847336 Duck_sajin E March 23, 2024, 12:47 a.m. OK C++14 (GCC 6-32) TESTS 41 78 2457600
252810039 Kangaroo_Splay E March 22, 2024, 5:20 p.m. OK C++14 (GCC 6-32) TESTS 41 78 9625600
252850088 masonpop E March 23, 2024, 1:44 a.m. OK C++14 (GCC 6-32) TESTS 41 78 10137600
252853767 pengyantong E March 23, 2024, 2:43 a.m. OK C++14 (GCC 6-32) TESTS 41 78 10240000
252812162 MMYYFF E March 22, 2024, 5:29 p.m. OK C++14 (GCC 6-32) TESTS 41 93 23449600
252809439 _RED__ E March 22, 2024, 5:18 p.m. OK C++14 (GCC 6-32) TESTS 41 108 6758400
252848301 Kuangchenrui E March 23, 2024, 1:07 a.m. OK C++14 (GCC 6-32) TESTS 41 171 9625600
252806139 lhy123 E March 22, 2024, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 41 31 6963200
252848602 a999999 E March 23, 2024, 1:13 a.m. OK C++17 (GCC 7-32) TESTS 41 46 7475200
252818458 The_Hallak E March 22, 2024, 6:17 p.m. OK C++17 (GCC 7-32) TESTS 41 61 5324800
252825071 ikaurov E March 22, 2024, 7:23 p.m. OK C++17 (GCC 7-32) TESTS 41 61 5632000
252835925 McPqndq E March 22, 2024, 9:22 p.m. OK C++17 (GCC 7-32) TESTS 41 62 1331200
252810069 WisdomCasual E March 22, 2024, 5:20 p.m. OK C++17 (GCC 7-32) TESTS 41 62 1740800
252806018 mufti E March 22, 2024, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 41 62 1843200
252834786 HajiAgha E March 22, 2024, 9:08 p.m. OK C++17 (GCC 7-32) TESTS 41 62 2457600
252849186 Cegax E March 23, 2024, 1:27 a.m. OK C++17 (GCC 7-32) TESTS 41 62 2560000
252812016 sanbi52 E March 22, 2024, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 41 62 2560000
252846143 1RONMAN E March 23, 2024, 12:21 a.m. OK C++20 (GCC 13-64) TESTS 41 31 102400
252811851 NourhanHanna E March 22, 2024, 5:28 p.m. OK C++20 (GCC 13-64) TESTS 41 31 5836800
252814348 Repeater111 E March 22, 2024, 5:43 p.m. OK C++20 (GCC 13-64) TESTS 41 31 6451200
252856523 flying_saucer E March 23, 2024, 3:21 a.m. OK C++20 (GCC 13-64) TESTS 41 31 6758400
252804291 Bukayo_Saka E March 22, 2024, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 41 31 14438400
252847419 1RONMAN E March 23, 2024, 12:49 a.m. OK C++20 (GCC 13-64) TESTS 41 46 0
252847340 mikekimkb E March 23, 2024, 12:47 a.m. OK C++20 (GCC 13-64) TESTS 41 46 0
252858412 shdut0901 E March 23, 2024, 3:45 a.m. OK C++20 (GCC 13-64) TESTS 41 46 2457600
252845743 1RONMAN E March 23, 2024, 12:12 a.m. OK C++20 (GCC 13-64) TESTS 41 46 2457600
252867812 yudati E March 23, 2024, 5:36 a.m. OK C++20 (GCC 13-64) TESTS 42 46 2560000
252806749 Gassa E March 22, 2024, 4:34 p.m. OK D TESTS 41 202 17100800
252816414 sleepntsheep E March 22, 2024, 6 p.m. OK GNU C11 TESTS 41 451 64102400
252857017 nguyenquocthao00 E March 23, 2024, 3:27 a.m. OK Go TESTS 41 62 15974400
252858640 nguyenquocthao00 E March 23, 2024, 3:48 a.m. OK Go TESTS 41 62 19353600
252855038 north_069 E March 23, 2024, 3:03 a.m. OK Go TESTS 41 108 4812800
252816001 dzhi E March 22, 2024, 5:56 p.m. OK Java 21 TESTS 41 373 2457600
252810954 profchi E March 22, 2024, 5:23 p.m. OK Java 21 TESTS 41 467 6860800
252809647 cc4414 E March 22, 2024, 5:19 p.m. OK Java 8 TESTS 41 171 2867200
252856832 codicon E March 23, 2024, 3:25 a.m. OK PyPy 3-64 TESTS 41 156 27852800
252809468 USYDLDH E March 22, 2024, 5:18 p.m. OK PyPy 3-64 TESTS 41 187 31948800
252809549 00zijian E March 22, 2024, 5:19 p.m. OK PyPy 3-64 TESTS 41 233 37580800
252867477 yuki_keshiki E March 23, 2024, 5:34 a.m. OK PyPy 3-64 TESTS 42 234 27852800
252809491 rope_and_snake E March 22, 2024, 5:18 p.m. OK PyPy 3-64 TESTS 41 248 30003200
252815106 Arpia E March 22, 2024, 5:49 p.m. OK PyPy 3-64 TESTS 41 249 25600000
252821213 googlweknoall E March 22, 2024, 6:43 p.m. OK PyPy 3-64 TESTS 41 327 40038400
252811016 Charming E March 22, 2024, 5:23 p.m. OK PyPy 3-64 TESTS 41 405 28364800
252804507 fireSlayer57 E March 22, 2024, 4:30 p.m. OK PyPy 3-64 TESTS 41 483 27955200
252809963 mj1000j E March 22, 2024, 5:20 p.m. OK PyPy 3-64 TESTS 41 498 26521600
252814581 OLOGY E March 22, 2024, 5:45 p.m. OK Python 2 TESTS 41 467 18636800
252826655 OLOGY E March 22, 2024, 7:39 p.m. OK Python 2 TESTS 41 623 17817600
252843427 edugong E March 22, 2024, 11:26 p.m. OK Python 3 TESTS 41 326 43315200
252810328 kost E March 22, 2024, 5:21 p.m. OK Rust 2021 TESTS 41 62 14848000
252804702 andrey.m E March 22, 2024, 4:30 p.m. OK Rust 2021 TESTS 41 78 4505600

remove filters

Back to search problems