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 |
---|---|---|---|---|---|---|
1656 | CodeTON Round 1 (Div. 1 + Div. 2, Rated, Prizes!) | FINISHED | False | 7200 | 83690699 | March 24, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 385 ) | G | Cycle Palindrome | PROGRAMMING | constructive algorithms math |
B'We say that a sequence of n integers a_1, a_2, ldots, a_n is a palindrome if for all 1 <= q i <= q n , a_i = a_{n-i+1} . You are given a sequence of n integers a_1, a_2, ldots, a_n and you have to find, if it exists, a cycle permutation sigma so that the sequence a_{ sigma(1)}, a_{ sigma(2)}, ldots, a_{ sigma(n)} is a palindrome. A permutation of 1, 2, ldots, n is a bijective function from {1, 2, ldots, n } to {1, 2, ldots, n } . We say that a permutation sigma is a cycle permutation if 1, sigma(1), sigma^2(1), ldots, sigma^{n-1}(1) are pairwise different numbers. Here sigma^m(1) denotes underbrace{ sigma( sigma( ldots sigma}_{m text{ times}}(1) ldots)) . The input consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 3 cdot 10^4 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains an integer n ( 2 <= q n <= q 2 cdot 10^5 ) -- the size of the sequence. The second line of each test case contains n integers a_1, ldots, a_n ( 1 <= q a_i <= q n ). The sum of n for all test cases is at most 2 cdot 10^5 . For each test case, output one line with YES if a cycle permutation exists, otherwise output one line with NO. If the answer is YES, output one additional line with n integers sigma(1), sigma(2), ldots, sigma(n) , the permutation. If there is more than one permutation, you may print any. '... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
150799938 | ugly2333 | G | March 24, 2022, 4:28 p.m. | OK | GNU C++14 | TESTS | 61 | 109 | 5324800 | ||
150840850 | Golovanov399 | G | March 25, 2022, 2:03 a.m. | OK | GNU C++17 | TESTS | 61 | 93 | 9113600 | ||
150807657 | Golovanov399 | G | March 24, 2022, 5:14 p.m. | OK | GNU C++17 | TESTS | 61 | 93 | 9113600 | ||
150831380 | peti1234 | G | March 24, 2022, 9:36 p.m. | OK | GNU C++17 | TESTS | 61 | 108 | 4198400 | ||
150831348 | peti1234 | G | March 24, 2022, 9:35 p.m. | OK | GNU C++17 | TESTS | 61 | 109 | 4198400 | ||
150817024 | sys. | G | March 24, 2022, 6:18 p.m. | OK | GNU C++17 | TESTS | 61 | 109 | 9830400 | ||
150848022 | Crabby_Maskiv | G | March 25, 2022, 4:31 a.m. | OK | GNU C++17 | TESTS | 61 | 249 | 38195200 | ||
150817465 | SirShokoladina | G | March 24, 2022, 6:22 p.m. | OK | GNU C++17 | TESTS | 61 | 343 | 10752000 | ||
150842328 | basic_string | G | March 25, 2022, 2:37 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 93 | 4812800 | ||
150807054 | sometimesnaive | G | March 24, 2022, 5:11 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 93 | 10854400 | ||
150800739 | Swistakk | G | March 24, 2022, 4:29 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 93 | 15974400 | ||
150846023 | kimoyami | G | March 25, 2022, 3:55 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 108 | 12083200 | ||
150838368 | Ronnie007 | G | March 25, 2022, 1:01 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 109 | 12083200 | ||
150809109 | LJC00118 | G | March 24, 2022, 5:21 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 140 | 12083200 | ||
150842069 | froggyzhang | G | March 25, 2022, 2:31 a.m. | OK | GNU C++17 (64) | TESTS | 61 | 155 | 33894400 | ||
150807810 | TLEwpdus | G | March 24, 2022, 5:14 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 186 | 3993600 | ||
150815128 | stevenkplus | G | March 24, 2022, 6:02 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 186 | 22528000 | ||
150814397 | noimi | G | March 24, 2022, 5:56 p.m. | OK | GNU C++17 (64) | TESTS | 61 | 187 | 20172800 | ||
150811799 | Raihanulislam12s | G | March 24, 2022, 5:37 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 93 | 11776000 | ||
150809308 | Raihanulislam12s | G | March 24, 2022, 5:22 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 93 | 11776000 | ||
150846994 | LuOH3 | G | March 25, 2022, 4:14 a.m. | OK | GNU C++20 (64) | TESTS | 61 | 93 | 13721600 | ||
150847849 | MoRanSky | G | March 25, 2022, 4:29 a.m. | OK | GNU C++20 (64) | TESTS | 61 | 170 | 12800000 | ||
150809795 | 5002ryx | G | March 24, 2022, 5:25 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 171 | 12800000 | ||
150854155 | Alan233 | G | March 25, 2022, 6:01 a.m. | OK | GNU C++20 (64) | TESTS | 61 | 171 | 29696000 | ||
150809114 | maroonrk | G | March 24, 2022, 5:21 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 217 | 44236800 | ||
150844062 | feecIe6418 | G | March 25, 2022, 3:14 a.m. | OK | GNU C++20 (64) | TESTS | 61 | 218 | 13619200 | ||
150807208 | gyh20 | G | March 24, 2022, 5:12 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 218 | 31539200 | ||
150800780 | jiangly_fan | G | March 24, 2022, 4:29 p.m. | OK | GNU C++20 (64) | TESTS | 61 | 327 | 31129600 |
Back to search problems