Codeforces Round 655 (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
1372 Codeforces Round 655 (Div. 2) FINISHED False 7200 142786463 July 11, 2020, 3:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 18094 ) C Omkar and Baseball PROGRAMMING constructive algorithms math 1500

B"Patrick likes to play baseball, but sometimes he will spend so many hours hitting home runs that his mind starts to get foggy! Patrick is sure that his scores across n sessions follow the identity permutation (ie. in the first game he scores 1 point, in the second game he scores 2 points and so on). However, when he checks back to his record, he sees that all the numbers are mixed up! Define a special exchange as the following: choose any subarray of the scores and permute elements such that no element of subarray gets to the same position as it was before the exchange. For example, performing a special exchange on [1,2,3] can yield [3,1,2] but it cannot yield [3,2,1] since the 2 is in the same position. Given a permutation of n integers, please help Patrick find the minimum number of special exchanges needed to make the permutation sorted! It can be proved that under given constraints this number doesn't exceed 10^{18} . An array a is a subarray of an array b if a can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 100 ). Description of the test cases follows. The first line of each test case contains integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the given permutation. The second line of each test case contains n integers a_{1},a_{2},...,a_{n} ( 1 <= q a_{i} <= q n ) -- the initial permutation. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output one integer: the minimum number of special exchanges needed to sort the permutation. In the first permutation, it is already sorted so no exchanges are needed. It can be shown that you need at least 2 "...

Tutorials

Codeforces Round #655 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
86595615 Gassa C July 11, 2020, 6:36 p.m. OK D TESTS 28 62 10854400 1500
86575947 ruban C July 11, 2020, 4:21 p.m. OK Delphi TESTS 28 77 28467200 1500
86563399 Pan_H C July 11, 2020, 3:54 p.m. OK GNU C++11 TESTS 28 15 3891200 1500
86622154 shengzihang C July 12, 2020, 5:43 a.m. OK GNU C++11 TESTS 30 30 4710400 1500
86555823 Wall_breaker C July 11, 2020, 3:43 p.m. OK GNU C++11 TESTS 28 30 4710400 1500
86615285 loceaner C July 12, 2020, 3:27 a.m. OK GNU C++11 TESTS 30 31 3891200 1500
86570565 smsylby C July 11, 2020, 4:07 p.m. OK GNU C++11 TESTS 28 31 3891200 1500
86568748 wang_sj C July 11, 2020, 4:03 p.m. OK GNU C++11 TESTS 28 31 3891200 1500
86566732 Watson_2020 C July 11, 2020, 4 p.m. OK GNU C++11 TESTS 28 31 3891200 1500
86577363 wind_cross C July 11, 2020, 4:25 p.m. OK GNU C++11 TESTS 28 31 4505600 1500
86613036 MengWH C July 12, 2020, 2:31 a.m. OK GNU C++11 TESTS 30 31 4710400 1500
86612453 suxxsfe C July 12, 2020, 2:17 a.m. OK GNU C++11 TESTS 30 31 4710400 1500
86597015 RaviVK C July 11, 2020, 6:51 p.m. OK GNU C++14 TESTS 28 46 3686400 1500
86619376 reddy_123 C July 12, 2020, 4:53 a.m. OK GNU C++14 TESTS 30 46 3788800 1500
86615834 IamNobody C July 12, 2020, 3:40 a.m. OK GNU C++14 TESTS 30 46 4505600 1500
86601846 himanshu7524 C July 11, 2020, 8:04 p.m. OK GNU C++14 TESTS 29 46 4505600 1500
86600036 flyinrabbitz C July 11, 2020, 7:33 p.m. OK GNU C++14 TESTS 29 46 4505600 1500
86595375 soap98 C July 11, 2020, 6:34 p.m. OK GNU C++14 TESTS 28 46 4505600 1500
86595112 handleitnow C July 11, 2020, 6:31 p.m. OK GNU C++14 TESTS 28 46 4505600 1500
86586885 Mdmitriy119 C July 11, 2020, 4:52 p.m. OK GNU C++14 TESTS 28 46 4505600 1500
86586151 tsaraf C July 11, 2020, 4:50 p.m. OK GNU C++14 TESTS 28 46 4505600 1500
86584181 zybkl C July 11, 2020, 4:44 p.m. OK GNU C++14 TESTS 28 46 4505600 1500

remove filters

Back to search problems