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 |
| 2011
|
Kotlin Heroes: Episode 11 |
FINISHED |
False |
9000 |
48785084 |
Sept. 30, 2024, 2:35 p.m. |
Problems
Yes, this is another one of those constructive permutation problems . You are given an integer (n). You have to construct a permutation (p) of size (n), i. e. an array of (n) integers, where every integer from (1) to (n) appears exactly once. Every pair of adjacent elements in the permutation ((p_i) and (p_{i+1})) must meet the following condition: if one of them is divisible by the other, the condition (p_i < p_{i+1}) must hold; otherwise, the condition (p_i > p_{i+1}) must hold. The first line contains one integer (t) ((1 \le t \le 99)) — the number of test cases. Each test case consists of one line, containing one integer (n) ((2 \le n \le 100)). For each test case, print the answer as follows: if no permutation of size (n) meeting the conditions from the statement exists, print (-1); otherwise, print (n) distinct integers from (1) to (n) — the required permutation. If there are mutliple answers, print any of them. |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
283776034 |
abusaeed2433 |
B |
Sept. 30, 2024, 2:40 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
202 |
0 |
|
|
|
283775783 |
tokitsukaze |
B |
Sept. 30, 2024, 2:39 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
202 |
614400 |
|
|
|
283775431 |
__jk__ |
B |
Sept. 30, 2024, 2:38 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
217 |
0 |
|
|
|
283777004 |
WiwiHo |
B |
Sept. 30, 2024, 2:45 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
217 |
307200 |
|
|
|
283776809 |
achhadahappy |
B |
Sept. 30, 2024, 2:44 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
218 |
0 |
|
|
|
283788570 |
Amit_ptp1617 |
B |
Sept. 30, 2024, 3:54 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
218 |
307200 |
|
|
|
283781532 |
FHH2004 |
B |
Sept. 30, 2024, 3:11 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
218 |
512000 |
|
|
|
283775817 |
Fysty |
B |
Sept. 30, 2024, 2:40 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
218 |
7680000 |
|
|
|
283789748 |
T_PAVAN_NAGARAJU |
B |
Sept. 30, 2024, 4 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
233 |
0 |
|
|
|
283777862 |
YhuanDebeste |
B |
Sept. 30, 2024, 2:50 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
233 |
0 |
|
|
|
283849427 |
mutbuffereduint512_t |
B |
Oct. 1, 2024, 5:16 a.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
109 |
0 |
|
|
|
283779883 |
kmyiu |
B |
Sept. 30, 2024, 3:01 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283779598 |
don_2004 |
B |
Sept. 30, 2024, 3 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283778932 |
caustique |
B |
Sept. 30, 2024, 2:57 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283776992 |
Slamur |
B |
Sept. 30, 2024, 2:45 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283776674 |
_RedWine_ |
B |
Sept. 30, 2024, 2:44 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283776438 |
Alenochka |
B |
Sept. 30, 2024, 2:42 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
124 |
0 |
|
|
|
283797717 |
VikramRathore |
B |
Sept. 30, 2024, 4:50 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
139 |
0 |
|
|
|
283778058 |
0xEmadeddin |
B |
Sept. 30, 2024, 2:51 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
139 |
0 |
|
|
|
283776137 |
Svyat |
B |
Sept. 30, 2024, 2:41 p.m. |
OK |
Kotlin 1.9 |
TESTS |
3 |
139 |
0 |
|
|
remove filters
Back to search problems