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"Koa the Koala has a matrix A of n rows and m columns. Elements of this matrix are distinct integers from 1 to n cdot m (each number from 1 to n cdot m appears exactly once in the matrix). For any matrix M of n rows and m columns let's define the following: Koa defines S(A) = (X, Y) as the spectrum of A , where X is the set of the maximum values in rows of A and Y is the set of the maximum values in columns of A . More formally: Koa asks you to find some matrix A' of n rows and m columns, such that each number from 1 to n cdot m appears exactly once in the matrix, and the following conditions hold: More formally: t is bitonic if there exists some position p ( 1 <= p <= k ) such that: t_1 < t_2 < ldots < t_p > t_{p+1} > ldots > t_k . Help Koa to find such matrix or to determine that it doesn't exist. The first line of the input contains two integers n and m ( 1 <= n, m <= 250 ) -- the number of rows and columns of A . Each of the ollowing n lines contains m integers. The j -th integer in the i -th line denotes element A_{ij} ( 1 <= A_{ij} <= n cdot m ) of matrix A . It is guaranteed that every number from 1 to n cdot m appears exactly once among elements of the matrix. If such matrix doesn't exist, print -1 on a single line. Otherwise, the output must consist of n lines, each one consisting of m space separated integers -- a description of A' . The j -th number in the i -th line represents the element A'_{ij} . Every integer from 1 to n cdot m should appear exactly once in A' , every row and column in A' must be bitonic and S(A) = S(A') must hold. If there are many answers print any. Let's analyze the first sample: For matrix A we have: For matrix "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
87928343 |
Gassa |
D |
July 24, 2020, 5:19 p.m. |
OK |
D |
TESTS |
58 |
280 |
29184000 |
|
|
87940053 |
rainboy |
D |
July 24, 2020, 8:08 p.m. |
OK |
GNU C11 |
TESTS |
58 |
234 |
4710400 |
|
|
88091494 |
emoairx |
D |
July 27, 2020, 1:29 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
31 |
5427200 |
|
|
90040964 |
architkarandikar |
D |
Aug. 15, 2020, 6:36 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
1024000 |
|
|
87931958 |
yao11617 |
D |
July 24, 2020, 5:59 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
4198400 |
|
|
88167658 |
TrivialMan |
D |
July 28, 2020, 3:08 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
4505600 |
|
|
88038462 |
_twilight |
D |
July 26, 2020, 8:06 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
4608000 |
|
|
88045480 |
zx2003 |
D |
July 26, 2020, 9:58 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
4915200 |
|
|
88841028 |
Zars19 |
D |
Aug. 4, 2020, 4:52 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
4915200 |
|
|
87903854 |
Apsara |
D |
July 24, 2020, 3:42 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
5017600 |
|
|
88763180 |
frodakcin |
D |
Aug. 2, 2020, 11:03 p.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
5017600 |
|
|
88657273 |
Carol_Luca |
D |
Aug. 1, 2020, 10:54 a.m. |
OK |
GNU C++11 |
TESTS |
58 |
46 |
5120000 |
|
|
88748845 |
codepainter |
D |
Aug. 2, 2020, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
4403200 |
|
|
89210475 |
schtomi97 |
D |
Aug. 7, 2020, 2:11 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
4608000 |
|
|
87933978 |
_no0B |
D |
July 24, 2020, 6:26 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
4915200 |
|
|
87936995 |
danya090699 |
D |
July 24, 2020, 7:12 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
4915200 |
|
|
88673641 |
Mihai145 |
D |
Aug. 1, 2020, 2:42 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5120000 |
|
|
90554647 |
Yazmau |
D |
Aug. 21, 2020, 2:55 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5120000 |
|
|
87904890 |
ccf_n0i |
D |
July 24, 2020, 3:44 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5324800 |
|
|
87945563 |
krijgertje |
D |
July 24, 2020, 10:39 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5324800 |
|
|
88382094 |
marcOS |
D |
July 29, 2020, 7:32 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5529600 |
|
|
88720126 |
SuperJ6 |
D |
Aug. 2, 2020, 9:48 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
46 |
5734400 |
|
|
90175345 |
Cahid |
D |
Aug. 16, 2020, 8:13 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
921600 |
|
|
90054585 |
Clouder0 |
D |
Aug. 16, 2020, 3:39 a.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
1024000 |
|
|
87996346 |
timf1089 |
D |
July 25, 2020, 3:04 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4096000 |
|
|
87921363 |
JasonBaby |
D |
July 24, 2020, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4198400 |
|
|
87966083 |
Hayven |
D |
July 25, 2020, 7:10 a.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4505600 |
|
|
87910308 |
catupper |
D |
July 24, 2020, 3:58 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4505600 |
|
|
88013778 |
adityapathak1630 |
D |
July 25, 2020, 8:10 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4505600 |
|
|
87965725 |
I_Love_Tourist_ |
D |
July 25, 2020, 7:05 a.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4710400 |
|
|
87934953 |
wiwitrifai |
D |
July 24, 2020, 6:40 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4710400 |
|
|
89530704 |
cyhan |
D |
Aug. 10, 2020, 6:46 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
46 |
4710400 |
|
|
87922050 |
NotaMotuaQAQ |
D |
July 24, 2020, 4:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
31 |
8806400 |
|
|
90501598 |
wwdd |
D |
Aug. 21, 2020, 1:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
819200 |
|
|
91604157 |
Geothermal |
D |
Sept. 2, 2020, 12:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
1126400 |
|
|
91264407 |
Rubblsh12345 |
D |
Aug. 29, 2020, 7:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
1228800 |
|
|
91616516 |
2sozx |
D |
Sept. 2, 2020, 6:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
1433600 |
|
|
90048864 |
Phortox |
D |
Aug. 15, 2020, 11:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
3481600 |
|
|
87978277 |
-lwl- |
D |
July 25, 2020, 10:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
4710400 |
|
|
87942673 |
ecnerwala |
D |
July 24, 2020, 9:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
4812800 |
|
|
87934937 |
ecnerwala |
D |
July 24, 2020, 6:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
4812800 |
|
|
87934603 |
ecnerwala |
D |
July 24, 2020, 6:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
46 |
4812800 |
|
|
88174110 |
PizzaLovers007 |
D |
July 28, 2020, 5:42 a.m. |
OK |
Java 11 |
TESTS |
58 |
218 |
31846400 |
|
|
88761959 |
Agnimandur |
D |
Aug. 2, 2020, 9:58 p.m. |
OK |
Java 8 |
TESTS |
58 |
155 |
20787200 |
|
|
90720116 |
MagentaCobra |
D |
Aug. 22, 2020, 11:50 p.m. |
OK |
Java 8 |
TESTS |
58 |
155 |
20889600 |
|
|
87911760 |
iakovlev.zakhar |
D |
July 24, 2020, 4:02 p.m. |
OK |
Java 8 |
TESTS |
58 |
171 |
20787200 |
|
|
87911220 |
sansen |
D |
July 24, 2020, 4:01 p.m. |
OK |
Rust |
TESTS |
58 |
46 |
6246400 |
|
|
remove filters
Back to search problems