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 |
---|---|---|---|---|---|---|
1205 | Codeforces Round 580 (Div. 1) | FINISHED | False | 7800 | 165687299 | Aug. 18, 2019, 1:45 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 123 ) | F | Beauty of a Permutation | PROGRAMMING | constructive algorithms math | 3400 |
B'Define the beauty of a permutation of numbers from 1 to n (p_1, p_2, ... , p_n) as number of pairs (L, R) such that 1 <= L <= R <= n and numbers p_L, p_{L+1}, ... , p_R are consecutive R-L+1 numbers in some order. For example, the beauty of the permutation (1, 2, 5, 3, 4) equals 9 , and segments, corresponding to pairs, are [1] , [2] , [5] , [4] , [3] , [1, 2] , [3, 4] , [5, 3, 4] , [1, 2, 5, 3, 4] . Answer q independent queries. In each query, you will be given integers n and k . Determine if there exists a permutation of numbers from 1 to n with beauty equal to k , and if there exists, output one of them. The first line contains a single integer q ( 1 <= q <= 10 ,000 ) -- the number of queries. Follow q lines. Each line contains two integers n , k ( 1 <= n <= 100 , 1 <= k <= frac{n(n+1)}{2} ) -- the length of permutation and needed beauty respectively. For a query output "NO", if such a permutation doesn 't exist. Otherwise, output "YES", and in the next line output n numbers -- elements of permutation in the right order. Let 's look at the first example. The first query: in (1) there is only one segment consisting of consecutive numbers -- the entire permutation. The second query: in (2, 4, 1, 5, 3) there are 6 such segments: [2] , [4] , [1] , [5] , [3] , [2, 4, 1, 5, 3] . There is no such permutation for the second query. The fourth query: in (2, 3, 1, 4, 5) there are 10 such segments: [2] , [3] , [1] , [4] , [5] , [2, 3] , [2, 3, 1] , [2, 3, 1, 4] , [4, 5] , [2, 3, 1, 4, 5] . '... |
69158 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
59129318 | yasugongshang | F | Aug. 20, 2019, 10:22 a.m. | OK | GNU C++11 | TESTS | 49 | 62 | 2867200 | 3400 | |
59409730 | AloneKnight | F | Aug. 24, 2019, 3:19 p.m. | OK | GNU C++11 | TESTS | 49 | 124 | 2355200 | 3400 | |
59131415 | nealchen | F | Aug. 20, 2019, 11:09 a.m. | OK | GNU C++11 | TESTS | 49 | 124 | 5836800 | 3400 | |
59131786 | nealchen | F | Aug. 20, 2019, 11:17 a.m. | OK | GNU C++11 | TESTS | 49 | 139 | 5836800 | 3400 | |
59079426 | WZYYN | F | Aug. 19, 2019, 8:29 a.m. | OK | GNU C++11 | TESTS | 49 | 140 | 614400 | 3400 | |
59409644 | AloneKnight | F | Aug. 24, 2019, 3:17 p.m. | OK | GNU C++11 | TESTS | 49 | 140 | 2355200 | 3400 | |
59409307 | AloneKnight | F | Aug. 24, 2019, 3:09 p.m. | OK | GNU C++11 | TESTS | 49 | 140 | 2355200 | 3400 | |
59131649 | nealchen | F | Aug. 20, 2019, 11:14 a.m. | OK | GNU C++11 | TESTS | 49 | 140 | 5836800 | 3400 | |
59201882 | luogu_bot1 | F | Aug. 21, 2019, 5:18 a.m. | OK | GNU C++11 | TESTS | 49 | 187 | 10649600 | 3400 | |
59108215 | EASHWATCH | F | Aug. 19, 2019, 7:01 p.m. | OK | GNU C++11 | TESTS | 49 | 218 | 20070400 | 3400 | |
61003642 | mayaohua2003 | F | Sept. 21, 2019, 10:29 a.m. | OK | GNU C++14 | TESTS | 49 | 109 | 4812800 | 3400 | |
59131512 | krijgertje | F | Aug. 20, 2019, 11:11 a.m. | OK | GNU C++14 | TESTS | 49 | 171 | 4300800 | 3400 | |
60524038 | Libitina | F | Sept. 14, 2019, 9:36 a.m. | OK | GNU C++14 | TESTS | 49 | 233 | 68300800 | 3400 | |
63385600 | rterte | F | Oct. 25, 2019, 1:41 p.m. | OK | GNU C++14 | TESTS | 49 | 233 | 69529600 | 3400 | |
68033661 | rterte | F | Jan. 1, 2020, 10:47 a.m. | OK | GNU C++14 | TESTS | 49 | 248 | 69427200 | 3400 | |
60346536 | fstqaq | F | Sept. 10, 2019, 12:46 p.m. | OK | GNU C++14 | TESTS | 49 | 249 | 68300800 | 3400 | |
59497174 | ecnerwala | F | Aug. 25, 2019, 11:28 p.m. | OK | GNU C++14 | TESTS | 49 | 249 | 69427200 | 3400 | |
60346726 | fstqaq | F | Sept. 10, 2019, 12:50 p.m. | OK | GNU C++14 | TESTS | 49 | 295 | 68300800 | 3400 | |
67990075 | lzoiexplorer2004 | F | Dec. 31, 2019, 3:52 a.m. | OK | GNU C++14 | TESTS | 49 | 327 | 102092800 | 3400 | |
60189863 | Motarack | F | Sept. 6, 2019, 8:36 p.m. | OK | GNU C++14 | TESTS | 49 | 405 | 10137600 | 3400 | |
62575569 | ak_taniya | F | Oct. 14, 2019, 3:48 p.m. | OK | GNU C++17 | TESTS | 49 | 140 | 84582400 | 3400 | |
60341501 | mu_xia_xiu_ji | F | Sept. 10, 2019, 11:02 a.m. | OK | GNU C++17 | TESTS | 49 | 140 | 84582400 | 3400 | |
59118291 | hjk1030 | F | Aug. 20, 2019, 3:09 a.m. | OK | GNU C++17 | TESTS | 49 | 202 | 17715200 | 3400 | |
59343982 | Worst_Coder17 | F | Aug. 23, 2019, 8:51 a.m. | OK | GNU C++17 | TESTS | 49 | 202 | 20275200 | 3400 | |
59064727 | Isonan | F | Aug. 19, 2019, 1:11 a.m. | OK | GNU C++17 | TESTS | 49 | 202 | 20275200 | 3400 | |
66394279 | ko_osaga | F | Dec. 6, 2019, 10:13 a.m. | OK | GNU C++17 | TESTS | 49 | 218 | 14438400 | 3400 | |
68060362 | rterte | F | Jan. 2, 2020, 3:11 a.m. | OK | GNU C++17 | TESTS | 49 | 248 | 69427200 | 3400 | |
59706336 | tEMMIE.w. | F | Aug. 30, 2019, 12:49 p.m. | OK | GNU C++17 | TESTS | 49 | 280 | 21504000 | 3400 | |
59129441 | ivan100sic | F | Aug. 20, 2019, 10:24 a.m. | OK | GNU C++17 | TESTS | 49 | 280 | 206745600 | 3400 | |
59810867 | jiangly | F | Aug. 31, 2019, 1:35 p.m. | OK | GNU C++17 | TESTS | 49 | 342 | 73932800 | 3400 | |
63706231 | user202729_ | F | Oct. 29, 2019, 8:30 a.m. | OK | PyPy 3 | TESTS | 49 | 1762 | 13414400 | 3400 |
Back to search problems