Codeforces Round 945 (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
1973 Codeforces Round 945 (Div. 2) FINISHED False 7200 21223463 May 17, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 836 ) E Cat, Fox and Swaps PROGRAMMING graphs math sortings 2500

B"Fox has found an array p_1, p_2, ldots, p_n , that is a permutation of length n^ dagger of the numbers 1, 2, ldots, n . She wants to sort the elements in increasing order. Cat wants to help her -- he is able to swap any two numbers x and y in the array, but only if l <= q x + y <= q r (note that the constraint is imposed on the values of the elements, not their positions). He can make such swaps any number of times. They don't know the numbers l , r yet, they only know that it's true that 1 <= q l <= q r <= q 2 cdot n . You are given the number n and the array p_1, p_2, ldots, p_n . Determine how many pairs (l, r) satisfying the conditions are there such that you can sort the permutation if you can only swap two number (x, y) such that l <= q x + y <= q r (arbitrary number of times, possibly 0 ). ^ dagger A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). 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. Description of each test case consists of two lines. The first line contains one integer n ( 1 <= q n <= q 10^5 ). The second line contains n integers: the array p_1, p_2, ldots, p_n ( 1 <= p_i <= n ). It is guaranteed that this array is a permutation of length n . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print the number of pairs of integers (l, r) such that 1 <= q l <= q r <= q 2 cdot n , and you can sort the array under the constraints. In the "...

Tutorials

Editorial for Codeforces Round #945 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
261716103 junshijun E May 20, 2024, 3 a.m. OK C++14 (GCC 6-32) TESTS 10 62 0 2500
262200614 g1ove E May 22, 2024, 11:04 p.m. OK C++14 (GCC 6-32) TESTS 10 62 409600 2500
261806819 yeminghan E May 20, 2024, 2:48 p.m. OK C++14 (GCC 6-32) TESTS 10 62 409600 2500
262446781 233L E May 25, 2024, 1:30 a.m. OK C++14 (GCC 6-32) TESTS 10 62 819200 2500
262150105 always_still E May 22, 2024, 1:06 p.m. OK C++14 (GCC 6-32) TESTS 10 62 819200 2500
262074600 Inexhaustible_ E May 22, 2024, 1:49 a.m. OK C++14 (GCC 6-32) TESTS 10 62 1228800 2500
262476790 __Watcher E May 25, 2024, 7:39 a.m. OK C++14 (GCC 6-32) TESTS 10 62 40140800 2500
263576591 vinaka_prime E June 1, 2024, 5:10 a.m. OK C++14 (GCC 6-32) TESTS 10 77 0 2500
262645528 JR-OIer E May 26, 2024, 4:03 a.m. OK C++14 (GCC 6-32) TESTS 10 77 0 2500
262314400 kassem_hmady E May 23, 2024, 9:41 p.m. OK C++14 (GCC 6-32) TESTS 10 77 0 2500
262449058 yyyyyd E May 25, 2024, 2:26 a.m. OK C++17 (GCC 7-32) TESTS 10 61 0 2500
261734792 brute_forceCE E May 20, 2024, 7:17 a.m. OK C++17 (GCC 7-32) TESTS 10 61 0 2500
261948685 liujunyi2 E May 21, 2024, 1:37 a.m. OK C++17 (GCC 7-32) TESTS 10 61 2048000 2500
263571754 _FAUST_ E June 1, 2024, 4:10 a.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
263206024 abbcc__1 E May 30, 2024, 6:42 a.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
262872111 wxgmjfhy E May 27, 2024, 11:33 a.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
262642045 I_Love_Homura E May 26, 2024, 3:31 a.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
262417273 granadierfc E May 24, 2024, 5:03 p.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
262414435 DogAndCat E May 24, 2024, 4:36 p.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
262411908 kmsgk E May 24, 2024, 4:13 p.m. OK C++17 (GCC 7-32) TESTS 10 62 0 2500
263690425 maxwellzen E June 2, 2024, 1:42 a.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
262862662 SMDS E May 27, 2024, 10:15 a.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
262329964 GaoYusong E May 24, 2024, 3:48 a.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
262070352 camc E May 22, 2024, 12:47 a.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
262067338 Rodger2041 E May 21, 2024, 11:11 p.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
261946010 zlxFTH E May 21, 2024, 12:45 a.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
261696299 Mifort E May 19, 2024, 7:25 p.m. OK C++20 (GCC 13-64) TESTS 10 61 0 2500
262105792 N_z__ E May 22, 2024, 7:28 a.m. OK C++20 (GCC 13-64) TESTS 10 61 102400 2500
261763569 Mercy. E May 20, 2024, 10:29 a.m. OK C++20 (GCC 13-64) TESTS 10 61 409600 2500
263530049 zaharvoloshko E May 31, 2024, 5:02 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0 2500
262649772 mg_05 E May 26, 2024, 5:02 a.m. OK GNU C11 TESTS 10 77 921600 2500
262399316 sgargoyle E May 24, 2024, 2:25 p.m. OK GNU C11 TESTS 10 108 1126400 2500
262858365 nguyenquocthao00 E May 27, 2024, 9:37 a.m. OK Go TESTS 10 77 4608000 2500
262485631 kl_2200031074 E May 25, 2024, 9:08 a.m. OK Java 8 TESTS 10 171 0 2500
262630419 Whosyourjay E May 25, 2024, 10:59 p.m. OK PyPy 3 TESTS 10 343 10342400 2500
263076772 SoleProprietor E May 29, 2024, 2:01 a.m. OK PyPy 3-64 TESTS 10 124 12902400 2500
262065545 Repsaj21o E May 21, 2024, 10:14 p.m. OK PyPy 3-64 TESTS 10 140 12902400 2500
262674205 hemingway23 E May 26, 2024, 8:30 a.m. OK PyPy 3-64 TESTS 10 218 14540800 2500
262016658 manavspg2 E May 21, 2024, 12:33 p.m. OK PyPy 3-64 TESTS 10 249 15257600 2500
262148664 2210080018 E May 22, 2024, 12:55 p.m. OK Python 3 TESTS 10 124 12800000 2500
262415141 leelarishika E May 24, 2024, 4:43 p.m. OK Python 3 TESTS 10 140 12800000 2500
262450198 Svlad_Cjelli E May 25, 2024, 2:46 a.m. OK Rust 2021 TESTS 10 62 0 2500
263202717 rli43 E May 30, 2024, 5:47 a.m. OK Rust 2021 TESTS 10 77 3993600 2500

remove filters

Back to search problems