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.
Problems
B"You are given n permutations a_1, a_2, ... , a_n , each of length m . Recall that a permutation of length m is a sequence of m distinct integers from 1 to m . Let the beauty of a permutation p_1, p_2, ... , p_m be the largest k such that p_1 = 1, p_2 = 2, ... , p_k = k . If p_1 neq 1 , then the beauty is 0 . The product of two permutations p cdot q is a permutation r such that r_j = q_{p_j} . For each i from 1 to n , print the largest beauty of a permutation a_i cdot a_j over all j from 1 to n (possibly, i = j ). The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of testcases. The first line of each testcase contains two integers n and m ( 1 <= n <= 5 cdot 10^4 ; 1 <= m <= 10 ) -- the number of permutations and the length of each permutation. The i -th of the next n lines contains a permutation a_i -- m distinct integers from 1 to m . The sum of n doesn't exceed 5 cdot 10^4 over all testcases. For each testcase, print n integers. The i -th value should be equal to the largest beauty of a permutation a_i cdot a_j over all j ( 1 <= j <= n ). "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
190440182 |
kcudcigam |
D |
Jan. 25, 2023, 2:36 a.m. |
OK |
GNU C++14 |
TESTS |
29 |
93 |
48128000 |
|
|
190404203 |
sunzz3183 |
D |
Jan. 24, 2023, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
93 |
48537600 |
|
|
190406266 |
BobPiggy |
D |
Jan. 24, 2023, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
93 |
212480000 |
|
|
190422042 |
JianrongHai |
D |
Jan. 24, 2023, 7:18 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
108 |
33280000 |
|
|
190421655 |
My_Sea |
D |
Jan. 24, 2023, 7:14 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
108 |
33280000 |
|
|
190403681 |
sunzz3183 |
D |
Jan. 24, 2023, 4:52 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
108 |
48537600 |
|
|
190421530 |
My_Sea |
D |
Jan. 24, 2023, 7:13 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
108 |
63283200 |
|
|
190413853 |
conexposys |
D |
Jan. 24, 2023, 6 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
109 |
6144000 |
|
|
190417013 |
Ice_teapoy |
D |
Jan. 24, 2023, 6:26 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
109 |
144281600 |
|
|
190405160 |
BobPiggy |
D |
Jan. 24, 2023, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
29 |
109 |
212377600 |
|
|
190443062 |
Kicamon |
D |
Jan. 25, 2023, 3:44 a.m. |
OK |
GNU C++17 |
TESTS |
29 |
93 |
25292800 |
|
|
190442826 |
pp_orange |
D |
Jan. 25, 2023, 3:39 a.m. |
OK |
GNU C++17 |
TESTS |
29 |
93 |
44134400 |
|
|
190410035 |
LittleDumbGoose |
D |
Jan. 24, 2023, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
93 |
46284800 |
|
|
190410679 |
LittleDumbGoose |
D |
Jan. 24, 2023, 5:36 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
93 |
48230400 |
|
|
190447062 |
Yzm007 |
D |
Jan. 25, 2023, 4:57 a.m. |
OK |
GNU C++17 |
TESTS |
29 |
108 |
24064000 |
|
|
190419922 |
er007 |
D |
Jan. 24, 2023, 6:55 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
108 |
43315200 |
|
|
190423979 |
Sajjat004 |
D |
Jan. 24, 2023, 7:41 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
108 |
99430400 |
|
|
190443429 |
Artteiv |
D |
Jan. 25, 2023, 3:53 a.m. |
OK |
GNU C++17 |
TESTS |
29 |
109 |
6144000 |
|
|
190430974 |
vgtcross |
D |
Jan. 24, 2023, 9:43 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
109 |
6144000 |
|
|
190400093 |
remastered |
D |
Jan. 24, 2023, 4:36 p.m. |
OK |
GNU C++17 |
TESTS |
29 |
109 |
6144000 |
|
|
190447154 |
Luv_Ray |
D |
Jan. 25, 2023, 4:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
62 |
96153600 |
|
|
190438718 |
Once_I_Liked_AGirl |
D |
Jan. 25, 2023, 1:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
78 |
26419200 |
|
|
190449170 |
Pointy |
D |
Jan. 25, 2023, 5:29 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
78 |
44134400 |
|
|
190420406 |
shuashuawan |
D |
Jan. 24, 2023, 7 p.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
78 |
66150400 |
|
|
190410828 |
xiaoyiru |
D |
Jan. 24, 2023, 5:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
78 |
246272000 |
|
|
190436424 |
AlephZero01 |
D |
Jan. 25, 2023, 12:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
93 |
2867200 |
|
|
190405769 |
jcccc |
D |
Jan. 24, 2023, 5:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
93 |
28672000 |
|
|
190408078 |
xiaoyiru |
D |
Jan. 24, 2023, 5:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
93 |
246272000 |
|
|
190447415 |
JYJin |
D |
Jan. 25, 2023, 5:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
108 |
7270400 |
|
|
190445663 |
linxd |
D |
Jan. 25, 2023, 4:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
29 |
109 |
87859200 |
|
|
190440874 |
pingpongdragon |
D |
Jan. 25, 2023, 2:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
62 |
26521600 |
|
|
190445321 |
worker_ |
D |
Jan. 25, 2023, 4:28 a.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
62 |
144588800 |
|
|
190410839 |
carlosad1 |
D |
Jan. 24, 2023, 5:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
1433600 |
|
|
190398901 |
guagua0407 |
D |
Jan. 24, 2023, 4:33 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
3686400 |
|
|
190401846 |
ayersz |
D |
Jan. 24, 2023, 4:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
24064000 |
|
|
190434333 |
onani |
D |
Jan. 24, 2023, 11:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
26521600 |
|
|
190419853 |
_AnyaForger_ |
D |
Jan. 24, 2023, 6:54 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
26624000 |
|
|
190425525 |
JianrongHai |
D |
Jan. 24, 2023, 8:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
33689600 |
|
|
190408674 |
bestzzz |
D |
Jan. 24, 2023, 5:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
43724800 |
|
|
190397620 |
zhongzhou |
D |
Jan. 24, 2023, 4:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
29 |
78 |
44646400 |
|
|
190405874 |
qiong-14 |
D |
Jan. 24, 2023, 5:03 p.m. |
OK |
Go |
TESTS |
29 |
358 |
36864000 |
|
|
190401777 |
qiong-14 |
D |
Jan. 24, 2023, 4:42 p.m. |
OK |
Go |
TESTS |
29 |
405 |
45977600 |
|
|
190443591 |
Sham050 |
D |
Jan. 25, 2023, 3:56 a.m. |
OK |
Java 11 |
TESTS |
29 |
467 |
13926400 |
|
|
190446812 |
Dinesh_Pandiyan |
D |
Jan. 25, 2023, 4:53 a.m. |
OK |
Java 11 |
TESTS |
29 |
467 |
14028800 |
|
|
190402952 |
merlin_ |
D |
Jan. 24, 2023, 4:48 p.m. |
OK |
Java 11 |
TESTS |
29 |
468 |
13926400 |
|
|
190449794 |
yyr2233 |
D |
Jan. 25, 2023, 5:38 a.m. |
OK |
Java 17 |
TESTS |
29 |
405 |
819200 |
|
|
190401677 |
frey4 |
D |
Jan. 24, 2023, 4:42 p.m. |
OK |
Java 17 |
TESTS |
29 |
452 |
22118400 |
|
|
190397059 |
Mamimi |
D |
Jan. 24, 2023, 4:31 p.m. |
OK |
Java 17 |
TESTS |
29 |
452 |
35737600 |
|
|
190406175 |
kkz666 |
D |
Jan. 24, 2023, 5:05 p.m. |
OK |
Java 17 |
TESTS |
29 |
654 |
73216000 |
|
|
190418609 |
Yuh_03 |
D |
Jan. 24, 2023, 6:42 p.m. |
OK |
Java 17 |
TESTS |
29 |
873 |
35328000 |
|
|
190432132 |
Mustela_Erminea |
D |
Jan. 24, 2023, 10:14 p.m. |
OK |
Java 17 |
TESTS |
29 |
1294 |
41164800 |
|
|
190397384 |
Socrates1232 |
D |
Jan. 24, 2023, 4:31 p.m. |
OK |
Java 8 |
TESTS |
29 |
265 |
16998400 |
|
|
190412282 |
lpychemistry |
D |
Jan. 24, 2023, 5:48 p.m. |
OK |
Java 8 |
TESTS |
29 |
342 |
31641600 |
|
|
190416143 |
AbdalrhmanJanem |
D |
Jan. 24, 2023, 6:18 p.m. |
OK |
Java 8 |
TESTS |
29 |
592 |
31232000 |
|
|
190416028 |
AbdalrhmanJanem |
D |
Jan. 24, 2023, 6:17 p.m. |
OK |
Java 8 |
TESTS |
29 |
764 |
31334400 |
|
|
190400219 |
AlanDiakov |
D |
Jan. 24, 2023, 4:36 p.m. |
OK |
Java 8 |
TESTS |
29 |
794 |
30617600 |
|
|
190415925 |
AbdalrhmanJanem |
D |
Jan. 24, 2023, 6:16 p.m. |
OK |
Java 8 |
TESTS |
29 |
1341 |
31436800 |
|
|
190404965 |
nya |
D |
Jan. 24, 2023, 4:58 p.m. |
OK |
Kotlin 1.7 |
TESTS |
29 |
1481 |
189849600 |
|
|
190399566 |
1434314294 |
D |
Jan. 24, 2023, 4:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
29 |
607 |
31846400 |
|
|
190437117 |
payday3 |
D |
Jan. 25, 2023, 1:08 a.m. |
OK |
MS C++ 2017 |
TESTS |
29 |
858 |
31129600 |
|
|
190425975 |
payday3 |
D |
Jan. 24, 2023, 8:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
29 |
904 |
31129600 |
|
|
190397530 |
_Makar_ |
D |
Jan. 24, 2023, 4:31 p.m. |
OK |
MS C++ 2017 |
TESTS |
29 |
997 |
41267200 |
|
|
190397201 |
KanishkGoel |
D |
Jan. 24, 2023, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
29 |
623 |
52326400 |
|
|
190418297 |
AadiS |
D |
Jan. 24, 2023, 6:39 p.m. |
OK |
PyPy 3 |
TESTS |
29 |
732 |
25395200 |
|
|
190398959 |
tan_delhi |
D |
Jan. 24, 2023, 4:33 p.m. |
OK |
PyPy 3 |
TESTS |
29 |
1076 |
79052800 |
|
|
190398267 |
tan_delhi |
D |
Jan. 24, 2023, 4:32 p.m. |
OK |
PyPy 3 |
TESTS |
29 |
1497 |
82329600 |
|
|
190425247 |
SoleProprietor |
D |
Jan. 24, 2023, 7:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
280 |
27545600 |
|
|
190447213 |
gardengnome |
D |
Jan. 25, 2023, 4:59 a.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
296 |
40140800 |
|
|
190436435 |
1__2345_6 |
D |
Jan. 25, 2023, 12:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
343 |
37376000 |
|
|
190411153 |
Sort |
D |
Jan. 24, 2023, 5:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
467 |
80588800 |
|
|
190400448 |
CinaDor |
D |
Jan. 24, 2023, 4:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
498 |
79257600 |
|
|
190417121 |
sushmanth.dampur8780 |
D |
Jan. 24, 2023, 6:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
530 |
74854400 |
|
|
190423526 |
MenaceJn |
D |
Jan. 24, 2023, 7:36 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
561 |
33484800 |
|
|
190396710 |
KanishkGoel |
D |
Jan. 24, 2023, 4:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
576 |
98099200 |
|
|
190427385 |
Triump_0112 |
D |
Jan. 24, 2023, 8:35 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
592 |
69529600 |
|
|
190414119 |
hkwu6013 |
D |
Jan. 24, 2023, 6:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
29 |
608 |
57139200 |
|
|
190415359 |
mathiaswk |
D |
Jan. 24, 2023, 6:12 p.m. |
OK |
Python 3 |
TESTS |
29 |
811 |
8499200 |
|
|
190438425 |
sabbirahmeds877 |
D |
Jan. 25, 2023, 1:50 a.m. |
OK |
Python 3 |
TESTS |
29 |
1091 |
19353600 |
|
|
190433417 |
Jason_Jiao |
D |
Jan. 24, 2023, 10:52 p.m. |
OK |
Python 3 |
TESTS |
29 |
1091 |
19353600 |
|
|
190445379 |
Swordelf |
D |
Jan. 25, 2023, 4:29 a.m. |
OK |
Rust 2021 |
TESTS |
29 |
108 |
12492800 |
|
|
190445319 |
Swordelf |
D |
Jan. 25, 2023, 4:28 a.m. |
OK |
Rust 2021 |
TESTS |
29 |
124 |
13721600 |
|
|
190426940 |
Felerius |
D |
Jan. 24, 2023, 8:28 p.m. |
OK |
Rust 2021 |
TESTS |
29 |
186 |
65536000 |
|
|
190412153 |
cottoncotton |
D |
Jan. 24, 2023, 5:47 p.m. |
OK |
Rust 2021 |
TESTS |
29 |
280 |
110592000 |
|
|
remove filters
Back to search problems