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'Petya collects beautiful matrix. A matrix of size n x n is beautiful if: Today Petya bought a beautiful matrix a of size n x n , and now he wants to determine its rarity. The rarity of the matrix is its index in the list of beautiful matrices of size n x n , sorted in lexicographical order. Matrix comparison is done row by row. (The index of lexicographically smallest matrix is zero). Since the number of beautiful matrices may be huge, Petya wants you to calculate the rarity of the matrix a modulo 998 ,244 ,353 . The first line contains one integer n ( 1 <= n <= 2000 ) -- the number of rows and columns in a . Each of the next n lines contains n integers a_{i,j} ( 1 <= a_{i,j} <= n ) -- the elements of a . It is guaranteed that a is a beautiful matrix. Print one integer -- the rarity of matrix a , taken modulo 998 ,244 ,353 . There are only 2 beautiful matrices of size 2 x 2 : There are the first 5 beautiful matrices of size 3 x 3 in lexicographical order: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
56375978 |
time_interspace |
G |
July 1, 2019, 6:34 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
343 |
32256000 |
|
2600 |
56878534 |
Sooke |
G |
July 12, 2019, 9:18 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
358 |
32051200 |
|
2600 |
50471890 |
DntcryBecthlev |
G |
Feb. 25, 2019, 1:47 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
358 |
205516800 |
|
2600 |
56040519 |
LJC00118 |
G |
June 25, 2019, 2:06 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
374 |
32256000 |
|
2600 |
56754170 |
Dilute |
G |
July 9, 2019, 1:10 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
374 |
48640000 |
|
2600 |
56752390 |
Dilute |
G |
July 9, 2019, 12:27 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
374 |
48640000 |
|
2600 |
50471868 |
DntcryBecthlev |
G |
Feb. 25, 2019, 1:46 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
374 |
205516800 |
|
2600 |
59800182 |
Big_black_jujube |
G |
Aug. 31, 2019, 9:57 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
390 |
32256000 |
|
2600 |
59800163 |
Big_black_jujube |
G |
Aug. 31, 2019, 9:56 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
405 |
32256000 |
|
2600 |
60474394 |
pbihao |
G |
Sept. 13, 2019, 7:18 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
842 |
65536000 |
|
2600 |
54546318 |
duxing201606 |
G |
May 24, 2019, 6:25 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
1060 |
32460800 |
|
2600 |
47510603 |
tmwilliamlin168 |
G |
Dec. 26, 2018, 6:15 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
1138 |
48128000 |
|
2600 |
54997442 |
chocorusk |
G |
June 3, 2019, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
1169 |
48537600 |
|
2600 |
69876688 |
jakedavis |
G |
Jan. 31, 2020, 4:25 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
1169 |
48640000 |
|
2600 |
55601158 |
sajibreadd |
G |
June 15, 2019, 6:28 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
1528 |
40550400 |
|
2600 |
47874972 |
LowR |
G |
Jan. 3, 2019, 2:52 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
1824 |
64819200 |
|
2600 |
47872831 |
LowR |
G |
Jan. 3, 2019, 1:47 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
1825 |
64819200 |
|
2600 |
54564714 |
NotNight |
G |
May 24, 2019, 3:45 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
2152 |
32358400 |
|
2600 |
52625026 |
aviroop123 |
G |
April 12, 2019, 2:32 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
2152 |
64716800 |
|
2600 |
48772370 |
icecuber |
G |
Jan. 23, 2019, 1:26 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
2355 |
96563200 |
|
2600 |
48654228 |
ReaLNero1 |
G |
Jan. 21, 2019, 1:24 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
405 |
49049600 |
|
2600 |
47609529 |
AuqaKyz |
G |
Dec. 28, 2018, 7:19 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1076 |
32460800 |
|
2600 |
55846551 |
aurinegro |
G |
June 20, 2019, 10:01 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
1092 |
32768000 |
|
2600 |
62963848 |
hjk1030 |
G |
Oct. 20, 2019, 3:07 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1123 |
32460800 |
|
2600 |
59710365 |
SGHD |
G |
Aug. 30, 2019, 2:25 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
1216 |
34201600 |
|
2600 |
48607679 |
zhangqingqi |
G |
Jan. 20, 2019, 11:51 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1309 |
65740800 |
|
2600 |
57979231 |
dragonslayerintraining |
G |
July 30, 2019, 8:45 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1341 |
32153600 |
|
2600 |
47634230 |
Holidin |
G |
Dec. 28, 2018, 2:59 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
1388 |
48230400 |
|
2600 |
47859484 |
Cothrax |
G |
Jan. 3, 2019, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1450 |
64819200 |
|
2600 |
58702487 |
Slaaava |
G |
Aug. 13, 2019, 8:19 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1575 |
96768000 |
|
2600 |
51303739 |
yiyangc91 |
G |
March 14, 2019, 3:43 p.m. |
OK |
Go |
TESTS |
68 |
1029 |
90931200 |
|
2600 |
remove filters
Back to search problems