Codeforces Round 694 (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
1470 Codeforces Round 694 (Div. 1) FINISHED False 7200 127322663 Jan. 5, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 300 ) E Strange Permutation PROGRAMMING binary search combinatorics data structures dp two pointers

B'Alice had a permutation p_1, p_2, ldots, p_n . Unfortunately, the permutation looked very boring, so she decided to change it and choose some non-overlapping subranges of this permutation and reverse them. The cost of reversing a single subrange [l, r] (elements from position l to position r , inclusive) is equal to r - l , and the cost of the operation is the sum of costs of reversing individual subranges. Alice had an integer c in mind, so she only considered operations that cost no more than c . Then she got really bored, and decided to write down all the permutations that she could possibly obtain by performing exactly one operation on the initial permutation. Of course, Alice is very smart, so she wrote down each obtainable permutation exactly once (no matter in how many ways it can be obtained), and of course the list was sorted lexicographically. Now Bob would like to ask Alice some questions about her list. Each question is in the following form: what is the i -th number in the j -th permutation that Alice wrote down? Since Alice is too bored to answer these questions, she asked you to help her out. The first line contains a single integer t ( 1 <= q t <= q 30 ) -- the number of test cases. The first line of each test case contains three integers n , c , q ( 1 <= q n <= q 3 cdot 10^4 , 1 <= q c <= q 4 , 1 <= q q <= q 3 cdot 10^5 ) -- the length of the permutation, the maximum cost of the operation, and the number of queries. The next line of each test case contains n integers p_1, p_2, ... , p_n ( 1 <= q p_i <= q n , p_i neq p_j if i neq j ), describing the initial permutation. The following q lines describe the queries. Each of them contains two integers i and j ( 1 <= q i <= q n , 1 <= q j <= q 10^{18} ), denoting parameters of this query. It is guaranteed that the sum of values n over all t'...

Tutorials

86464

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
103473336 IgorI E Jan. 5, 2021, 6:54 p.m. OK GNU C++17 TESTS 199 514 33075200
103475971 sh1194 E Jan. 5, 2021, 7:23 p.m. OK GNU C++17 TESTS 199 795 3686400
103473047 NiroBC E Jan. 5, 2021, 6:51 p.m. OK GNU C++17 TESTS 199 795 3686400
103476093 sh1194 E Jan. 5, 2021, 7:25 p.m. OK GNU C++17 TESTS 199 841 3686400
103458872 lumibons E Jan. 5, 2021, 4:30 p.m. OK GNU C++17 TESTS 199 967 11468800
103487486 Bohun E Jan. 5, 2021, 11:12 p.m. OK GNU C++17 TESTS 199 1013 22528000
103481637 mango_lassi E Jan. 5, 2021, 8:47 p.m. OK GNU C++17 TESTS 199 1138 3891200
103479822 gisp_zjz E Jan. 5, 2021, 8:17 p.m. OK GNU C++17 TESTS 199 1310 6246400
103476082 Alice_foo_foo E Jan. 5, 2021, 7:25 p.m. OK GNU C++17 TESTS 199 1716 20684800
103492564 _Senior E Jan. 6, 2021, 1:44 a.m. OK GNU C++17 TESTS 199 1808 46694400
103440669 tourist E Jan. 5, 2021, 3:50 p.m. OK GNU C++17 (64) TESTS 199 826 5222400
103456209 ecnerwala E Jan. 5, 2021, 4:24 p.m. OK GNU C++17 (64) TESTS 199 857 12492800
103427287 neal E Jan. 5, 2021, 3:25 p.m. OK GNU C++17 (64) TESTS 199 919 5529600
103475910 HIR180 E Jan. 5, 2021, 7:23 p.m. OK GNU C++17 (64) TESTS 199 1154 8908800
103475749 HIR180 E Jan. 5, 2021, 7:20 p.m. OK GNU C++17 (64) TESTS 199 1169 8908800
103450045 Petr E Jan. 5, 2021, 4:11 p.m. OK GNU C++17 (64) TESTS 199 1263 31948800
103444803 ainta E Jan. 5, 2021, 3:59 p.m. OK GNU C++17 (64) TESTS 199 1309 4096000
103459429 Maksim1744 E Jan. 5, 2021, 4:31 p.m. OK GNU C++17 (64) TESTS 199 1466 16486400
103446807 Radewoosh E Jan. 5, 2021, 4:03 p.m. OK GNU C++17 (64) TESTS 199 1793 100352000
103490936 Geothermal E Jan. 6, 2021, 1:02 a.m. OK GNU C++17 (64) TESTS 199 1809 57344000

remove filters

Back to search problems