Codeforces Round 740 (Div. 1, based on VK Cup 2021 - Final (Engine))

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
1558 Codeforces Round 740 (Div. 1, based on VK Cup 2021 - Final (Engine)) FINISHED False 9000 107364263 Aug. 24, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 997 ) D Top-Notch Insertions PROGRAMMING combinatorics data structures 2600

B"Consider the insertion sort algorithm used to sort an integer sequence [a_1, a_2, ldots, a_n] of length n in non-decreasing order. For each i in order from 2 to n , do the following. If a_i ge a_{i-1} , do nothing and move on to the next value of i . Otherwise, find the smallest j such that a_i < a_j , shift the elements on positions from j to i-1 by one position to the right, and write down the initial value of a_i to position j . In this case we'll say that we performed an insertion of an element from position i to position j . It can be noticed that after processing any i , the prefix of the sequence [a_1, a_2, ldots, a_i] is sorted in non-decreasing order, therefore, the algorithm indeed sorts any sequence. For example, sorting [4, 5, 3, 1, 3] proceeds as follows: You are given an integer n and a list of m integer pairs (x_i, y_i) . We are interested in sequences such that if you sort them using the above algorithm, exactly m insertions will be performed: first from position x_1 to position y_1 , then from position x_2 to position y_2 , ..., finally, from position x_m to position y_m . How many sequences of length n consisting of (not necessarily distinct) integers between 1 and n , inclusive, satisfy the above condition? Print this number modulo 998 ,244 ,353 . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). Description of the test cases follows. The first line of each test case contains two integers n and m ( 2 <= n <= 2 cdot 10^5 ; 0 <= m < n ) -- the length of the sequence and the number of insertions. The i -th of the following m lines contains two integers x_i and y_i ( 2 <= x_1 < x_2 < ldots < x_m <= n ; 1 <= y_i < x_i ). These li"...

Tutorials

Codeforces Round #740 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
126973253 Suiseiseki D Aug. 25, 2021, 1:38 p.m. OK GNU C++14 TESTS 75 202 14950400 2600
126930206 F1aMiR3 D Aug. 25, 2021, 3:50 a.m. OK GNU C++14 TESTS 75 217 11161600 2600
126932784 skicean D Aug. 25, 2021, 4:37 a.m. OK GNU C++14 TESTS 75 233 12492800 2600
126897101 ghj1222 D Aug. 24, 2021, 4:39 p.m. OK GNU C++14 TESTS 75 234 10137600 2600
126878861 Subconscious D Aug. 24, 2021, 3:46 p.m. OK GNU C++14 TESTS 75 234 14233600 2600
126876122 ugly2333 D Aug. 24, 2021, 3:39 p.m. OK GNU C++14 TESTS 75 234 18432000 2600
126968489 nwi D Aug. 25, 2021, 12:33 p.m. OK GNU C++14 TESTS 75 248 15769600 2600
126921474 SrO D Aug. 25, 2021, 12:11 a.m. OK GNU C++14 TESTS 75 249 12390400 2600
126890180 MoRanSky D Aug. 24, 2021, 4:17 p.m. OK GNU C++14 TESTS 75 249 13721600 2600
126891181 xcyle D Aug. 24, 2021, 4:20 p.m. OK GNU C++14 TESTS 75 249 16588800 2600
126951126 acwing_meow D Aug. 25, 2021, 8:35 a.m. OK GNU C++17 TESTS 75 171 10342400 2600
126978095 ynycoding D Aug. 25, 2021, 2:37 p.m. OK GNU C++17 TESTS 75 218 14950400 2600
126970141 ButterCake D Aug. 25, 2021, 12:59 p.m. OK GNU C++17 TESTS 75 234 11776000 2600
126968892 vjudge3 D Aug. 25, 2021, 12:42 p.m. OK GNU C++17 TESTS 75 249 12390400 2600
126899101 CuCl2 D Aug. 24, 2021, 4:46 p.m. OK GNU C++17 TESTS 75 249 12390400 2600
126895528 Pigbrain D Aug. 24, 2021, 4:34 p.m. OK GNU C++17 TESTS 75 249 12595200 2600
126931393 Melania D Aug. 25, 2021, 4:10 a.m. OK GNU C++17 TESTS 75 249 13004800 2600
126976845 farmerboy D Aug. 25, 2021, 2:22 p.m. OK GNU C++17 TESTS 75 249 13414400 2600
126921120 wifiiii D Aug. 24, 2021, 11:56 p.m. OK GNU C++17 TESTS 75 249 15155200 2600
126929521 C20191629 D Aug. 25, 2021, 3:36 a.m. OK GNU C++17 TESTS 75 249 15564800 2600
126924579 njwrz D Aug. 25, 2021, 1:53 a.m. OK GNU C++17 (64) TESTS 75 155 91136000 2600
126894151 noshi91 D Aug. 24, 2021, 4:29 p.m. OK GNU C++17 (64) TESTS 75 186 14950400 2600
126936752 rniya D Aug. 25, 2021, 5:37 a.m. OK GNU C++17 (64) TESTS 75 186 15769600 2600
126889652 Kude D Aug. 24, 2021, 4:16 p.m. OK GNU C++17 (64) TESTS 75 186 17408000 2600
126951378 CartesianTree D Aug. 25, 2021, 8:38 a.m. OK GNU C++17 (64) TESTS 75 186 21606400 2600
126894208 dorijanlendvaj D Aug. 24, 2021, 4:30 p.m. OK GNU C++17 (64) TESTS 75 186 21811200 2600
126871952 natsugiri D Aug. 24, 2021, 3:29 p.m. OK GNU C++17 (64) TESTS 75 187 14643200 2600
126895937 Svlad_Cjelli D Aug. 24, 2021, 4:35 p.m. OK GNU C++17 (64) TESTS 75 187 15257600 2600
127009261 zykmd D Aug. 26, 2021, 1:57 a.m. OK GNU C++17 (64) TESTS 75 187 15769600 2600
126981333 AutumnKite D Aug. 25, 2021, 3:12 p.m. OK GNU C++17 (64) TESTS 75 202 12390400 2600
126889650 clyring D Aug. 24, 2021, 4:16 p.m. OK Haskell TESTS 75 1029 45363200 2600
126896340 dalt D Aug. 24, 2021, 4:36 p.m. OK Java 11 TESTS 75 514 32358400 2600
126908767 Sohomot_Vai D Aug. 24, 2021, 6:11 p.m. OK Java 11 TESTS 75 607 40038400 2600
126914572 YahiaSherif D Aug. 24, 2021, 7:48 p.m. OK Java 8 TESTS 75 1325 37580800 2600
126956201 azukun D Aug. 25, 2021, 9:39 a.m. OK .NET Core C# TESTS 75 296 40140800 2600
126956156 azukun D Aug. 25, 2021, 9:38 a.m. OK .NET Core C# TESTS 75 311 38502400 2600
126948078 azukun D Aug. 25, 2021, 7:58 a.m. OK .NET Core C# TESTS 75 389 40038400 2600
126955398 azukun D Aug. 25, 2021, 9:28 a.m. OK .NET Core C# TESTS 75 420 40140800 2600
126907057 chinerist D Aug. 24, 2021, 5:57 p.m. OK PyPy 3 TESTS 75 2901 219955200 2600
126915043 sansen D Aug. 24, 2021, 7:59 p.m. OK Rust TESTS 75 155 17920000 2600
126907177 sansen D Aug. 24, 2021, 5:57 p.m. OK Rust TESTS 75 2433 14848000 2600

remove filters

Back to search problems