Codeforces Round 1089 (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
2210 Codeforces Round 1089 (Div. 2) FINISHED False 8100 1610723 March 29, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 21223 ) A A Simple Sequence PROGRAMMING constructive algorithms dp greedy number theory

You are given an integer (n). You need to construct a permutation(^{\text{∗}}) (a_1, a_2, \ldots, a_n) using integers from (1) to (n) such that the following condition is satisfied: () a_1 \bmod a_2 \ge a_2 \bmod a_3 \geq \ldots \ge a_{n-1} \bmod a_{n}, () where (u) mod (v) denotes the remainder of dividing (u) by (v). If multiple valid permutations exist, you may output any of them. It can be shown that a valid permutation always exists for every (n \ge 2). (^{\text{∗}})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 \le t \le 100)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 100)). For each test case, output on a single line (n) space-separated integers (a_1, a_2, \ldots a_n). If multiple valid permutations exist, you may output any of them. In the second test case, (2 \bmod 3 \ge 3 \bmod 1), so the permutation (2, 3, 1) is valid. In the third test case, (2 \bmod 4 \ge 4 \bmod 3 \ge 3 \bmod 1), so the permutation (2, 4, 3, 1) is valid.

Tutorials

Codeforces Round 1089 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
368796977 LazyMind A March 30, 2026, 2:10 a.m. OK C# 13 TESTS 3 62 409600
368760633 OlegR A March 29, 2026, 4:27 p.m. OK C# 13 TESTS 3 62 409600
368799858 _Equinox A March 30, 2026, 3:19 a.m. OK C# 13 TESTS 3 62 13209600
368803846 bbld10w0 A March 30, 2026, 4:33 a.m. OK C# 13 TESTS 3 78 13209600
368778277 ggggggggggg22 A March 29, 2026, 6:46 p.m. OK C# 13 TESTS 3 93 409600

remove filters

Back to search problems