Codeforces Round 879 (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
1834 Codeforces Round 879 (Div. 2) FINISHED False 7200 50104463 June 18, 2023, 8:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 540 ) F Typewriter PROGRAMMING data structures math

B'Recently, Polycarp was given an unusual typewriter as a gift! Unfortunately, the typewriter was defective and had a rather strange design. The typewriter consists of n cells numbered from left to right from 1 to n , and a carriage that moves over them. The typewriter cells contain n distinct integers from 1 to n , and each cell i initially contains the integer p_i . Before all actions, the carriage is at cell number 1 and there is nothing in its buffer storage. The cell on which the carriage is located is called the current cell. The carriage can perform five types of operations: Polycarp was very interested in this typewriter, so he asks you to help him understand it and will ask you q queries of three types: Before and after each query, Polycarp wants to know what minimum number of carriage resets is needed for the current sequence in order to distribute the numbers to their cells (so that the number i ends up in cell number i ). Note that Polycarp only wants to know the minimum number of carriage resets required to arrange the numbers in their places, but he does not actually distribute them. Help Polycarp find the answers to his queries! The first line contains a single integer n ( 1 <= n <= 4 cdot 10^5 ) -- the number of cells. The second line contains n distinct integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ) -- the initial arrangement of integers in the cells. The third line contains a single integer q ( 0 <= q <= 4 cdot 10^5 ) -- the number of queries. Each of the next q lines describes a query from Polycarp: The j -th line, at first, contains the integer t_j ( 1 <= t_j <= 3 ) -- the type of query. If the query is of type t_j = 1 or t_j = 2 , then the integer k_j ( 1 <= k_j <= n ) -- the length of the shift -- follows in the same line. Output q + 1 numbers -- the minim'...

Tutorials

Codeforces Round #879 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
210103817 pengyule F June 18, 2023, 1:33 p.m. OK GNU C++14 TESTS 65 109 21811200
210188915 zltzlt F June 18, 2023, 11:10 p.m. OK GNU C++14 TESTS 65 343 40140800
210087090 zltzlt F June 18, 2023, 10:37 a.m. OK GNU C++14 TESTS 65 358 40140800
210077908 i_am_sinsop90 F June 18, 2023, 9:51 a.m. OK GNU C++14 TESTS 65 358 40140800
210194455 ling_chen F June 19, 2023, 2:09 a.m. OK GNU C++14 TESTS 65 373 4812800
210192640 Alaskan F June 19, 2023, 1:18 a.m. OK GNU C++14 TESTS 65 374 6451200
210082803 paul2008 F June 18, 2023, 10:04 a.m. OK GNU C++14 TESTS 65 421 4812800
210085805 paul2008 F June 18, 2023, 10:28 a.m. OK GNU C++14 TESTS 65 436 4812800
210074011 znstz_2210QaQ F June 18, 2023, 9:39 a.m. OK GNU C++14 TESTS 65 436 12800000
210080638 Star32 F June 18, 2023, 9:59 a.m. OK GNU C++14 TESTS 65 826 19251200
210191733 rqoi032 F June 19, 2023, 12:52 a.m. OK GNU C++17 TESTS 65 280 4812800
210174980 archiver F June 18, 2023, 6:14 p.m. OK GNU C++17 TESTS 65 343 4812800
210092293 kostylevGO F June 18, 2023, 11:25 a.m. OK GNU C++17 TESTS 65 358 6451200
210092018 amirhoseinfar1385 F June 18, 2023, 11:22 a.m. OK GNU C++17 TESTS 65 358 6451200
210084035 zlc1114 F June 18, 2023, 10:18 a.m. OK GNU C++17 TESTS 65 358 12083200
210085164 hieplpvip F June 18, 2023, 10:23 a.m. OK GNU C++17 TESTS 65 358 20070400
210193952 taiwanguo F June 19, 2023, 1:55 a.m. OK GNU C++17 TESTS 65 373 4812800
210204169 AKALemon F June 19, 2023, 5:26 a.m. OK GNU C++17 TESTS 65 373 6451200
210099008 xuqin F June 18, 2023, 12:35 p.m. OK GNU C++17 TESTS 65 374 4812800
210204139 AKALemon F June 19, 2023, 5:26 a.m. OK GNU C++17 TESTS 65 374 6451200
210192300 244mhq F June 19, 2023, 1:08 a.m. OK GNU C++17 (64) TESTS 65 234 6451200
210092322 kostylevGO F June 18, 2023, 11:25 a.m. OK GNU C++17 (64) TESTS 65 249 6451200
210199056 Alex_Wei F June 19, 2023, 3:49 a.m. OK GNU C++17 (64) TESTS 65 249 7475200
210102305 toniskrijelj F June 18, 2023, 1:14 p.m. OK GNU C++17 (64) TESTS 65 264 25292800
210081874 Kude F June 18, 2023, 10:02 a.m. OK GNU C++17 (64) TESTS 65 280 9625600
210076989 EnEm F June 18, 2023, 9:48 a.m. OK GNU C++17 (64) TESTS 65 295 6451200
210087060 YocyCraft F June 18, 2023, 10:36 a.m. OK GNU C++17 (64) TESTS 65 311 11264000
210084644 Superposition F June 18, 2023, 10:21 a.m. OK GNU C++17 (64) TESTS 65 358 16076800
210196660 enslaved F June 19, 2023, 3 a.m. OK GNU C++17 (64) TESTS 65 374 36966400
210094404 PEKKA_l F June 18, 2023, 11:47 a.m. OK GNU C++17 (64) TESTS 65 904 185958400
210093225 kostylevGO F June 18, 2023, 11:35 a.m. OK GNU C++20 (64) TESTS 65 93 6451200
210094760 Tobo F June 18, 2023, 11:51 a.m. OK GNU C++20 (64) TESTS 65 187 4812800
210103005 SATSKY F June 18, 2023, 1:23 p.m. OK GNU C++20 (64) TESTS 65 187 6451200
210091848 kostylevGO F June 18, 2023, 11:20 a.m. OK GNU C++20 (64) TESTS 65 187 6451200
210184770 A_G F June 18, 2023, 8:58 p.m. OK GNU C++20 (64) TESTS 65 202 4812800
210182736 Gamal74 F June 18, 2023, 8:18 p.m. OK GNU C++20 (64) TESTS 65 202 4812800
210102196 _shakespeare_ F June 18, 2023, 1:12 p.m. OK GNU C++20 (64) TESTS 65 202 4812800
210079002 LowPill F June 18, 2023, 9:54 a.m. OK GNU C++20 (64) TESTS 65 202 4812800
210103119 SATSKY F June 18, 2023, 1:24 p.m. OK GNU C++20 (64) TESTS 65 202 6451200
210094403 propane F June 18, 2023, 11:47 a.m. OK GNU C++20 (64) TESTS 65 202 6451200
210090807 Little_Sheep_Yawn F June 18, 2023, 11:09 a.m. OK PyPy 3-64 TESTS 65 576 75571200
210083623 Xiao_Yang_0725 F June 18, 2023, 10:17 a.m. OK PyPy 3-64 TESTS 65 576 75571200

remove filters

Back to search problems