Codeforces Global Round 13

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
1491 Codeforces Global Round 13 FINISHED False 10800 122747062 Feb. 28, 2021, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 850 ) G Switch and Flip PROGRAMMING constructive algorithms math

B'There are n coins labeled from 1 to n . Initially, coin c_i is on position i and is facing upwards (( c_1, c_2, ... , c_n) is a permutation of numbers from 1 to n ). You can do some operations on these coins. In one operation, you can do the following: Choose 2 distinct indices i and j . Then, swap the coins on positions i and j . Then, flip both coins on positions i and j . (If they are initially faced up, they will be faced down after the operation and vice versa) Construct a sequence of at most n+1 operations such that after performing all these operations the coin i will be on position i at the end, facing up. Note that you do not need to minimize the number of operations. The first line contains an integer n ( 3 <= q n <= q 2 cdot 10^5 ) -- the number of coins. The second line contains n integers c_1,c_2, ... ,c_n ( 1 <= c_i <= n , c_i neq c_j for i neq j ). In the first line, output an integer q (0 <= q q <= q n+1) -- the number of operations you used. In the following q lines, output two integers i and j (1 <= q i, j <= q n, i ne j) -- the positions you chose for the current operation. Let coin i facing upwards be denoted as i and coin i facing downwards be denoted as -i . The series of moves performed in the first sample changes the coins as such: In the second sample, the coins are already in their correct positions so there is no need to swap. '...

Tutorials

Codeforces Global Round 13 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
108741623 LJC00118 G Feb. 28, 2021, 4:28 p.m. OK GNU C++11 TESTS 55 93 11980800
108766464 szhlg G March 1, 2021, 3:28 a.m. OK GNU C++11 TESTS 55 93 12492800
108762527 little_brush G March 1, 2021, 12:49 a.m. OK GNU C++11 TESTS 55 109 8396800
108768954 18Michael G March 1, 2021, 4:38 a.m. OK GNU C++11 TESTS 55 109 9011200
108768830 18Michael G March 1, 2021, 4:35 a.m. OK GNU C++11 TESTS 55 109 9011200
108766538 SSerxhs G March 1, 2021, 3:30 a.m. OK GNU C++11 TESTS 55 109 36249600
108766094 SSerxhs G March 1, 2021, 3:15 a.m. OK GNU C++11 TESTS 55 109 36352000
108762109 Wu_Ren G March 1, 2021, 12:25 a.m. OK GNU C++11 TESTS 55 124 4198400
108766196 Hongzy G March 1, 2021, 3:18 a.m. OK GNU C++11 TESTS 55 124 8601600
108770410 dijkstra54321 G March 1, 2021, 5:10 a.m. OK GNU C++11 TESTS 55 124 8908800

remove filters

Back to search problems