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'After a hard-working week Polycarp prefers to have fun. Polycarp 's favorite entertainment is drawing snakes. He takes a rectangular checkered sheet of paper of size n x m (where n is the number of rows, m is the number of columns) and starts to draw snakes in cells. Polycarp draws snakes with lowercase Latin letters. He always draws the first snake with the symbol 'a ', the second snake with the symbol 'b ', the third snake with the symbol 'c ' and so on. All snakes have their own unique symbol. There are only 26 letters in the Latin alphabet, Polycarp is very tired and he doesn 't want to invent new symbols, so the total number of drawn snakes doesn 't exceed 26 . Since by the end of the week Polycarp is very tired, he draws snakes as straight lines without bends. So each snake is positioned either vertically or horizontally. Width of any snake equals 1 , i.e. each snake has size either 1 x l or l x 1 , where l is snake 's length. Note that snakes can 't bend. When Polycarp draws a new snake, he can use already occupied cells for drawing the snake. In this situation, he draws the snake "over the top" and overwrites the previous value in the cell. Recently when Polycarp was at work he found a checkered sheet of paper with Latin letters. He wants to know if it is possible to get this sheet of paper from an empty sheet by drawing some snakes according to the rules described above. If it is possible, he is interested in a way to draw snakes. The first line of the input contains one integer t ( 1 <= t <= 10^5 ) -- the number of test cases to solve. Then t test cases follow. The first line of the test case description contains two integers n , m ( 1 <= n,m <= 2000 ) -- length and width of the checkered sheet of paper respectively. Next n lines of test case description contain m symbols, which are responsible for the content of the corresponding cell on t'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
56855486 |
ruban |
E |
July 11, 2019, 6:07 p.m. |
OK |
Delphi |
TESTS |
44 |
608 |
45056000 |
|
2000 |
56855305 |
ruban |
E |
July 11, 2019, 6:01 p.m. |
OK |
Delphi |
TESTS |
44 |
748 |
45056000 |
|
2000 |
56050304 |
7NationTengri |
E |
June 25, 2019, 6:42 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
93 |
64102400 |
|
2000 |
55854507 |
Rockyyh |
E |
June 21, 2019, 6:18 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
109 |
41676800 |
|
2000 |
55832500 |
Frame233 |
E |
June 20, 2019, 1:49 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
109 |
64614400 |
|
2000 |
55846640 |
Frame233 |
E |
June 20, 2019, 10:09 p.m. |
OK |
GNU C++11 |
TESTS |
44 |
124 |
64614400 |
|
2000 |
56144615 |
XiaoTaoTao |
E |
June 27, 2019, 5:32 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
3891200 |
|
2000 |
58374914 |
1551105887 |
E |
Aug. 6, 2019, 7:56 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
4096000 |
|
2000 |
56300086 |
StartAgain |
E |
June 30, 2019, 8:22 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
4096000 |
|
2000 |
55815439 |
crawarb |
E |
June 20, 2019, 6:14 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
4096000 |
|
2000 |
55917570 |
msuwakow |
E |
June 22, 2019, 6:09 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
4403200 |
|
2000 |
55860662 |
disangan233 |
E |
June 21, 2019, 9:23 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
171 |
8089600 |
|
2000 |
55845214 |
dakuhosu |
E |
June 20, 2019, 8:45 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
155 |
4096000 |
|
2000 |
55866466 |
kgcurry59 |
E |
June 21, 2019, 12:25 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
155 |
8089600 |
|
2000 |
58987670 |
rfpermen |
E |
Aug. 18, 2019, 7:51 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
3993600 |
|
2000 |
57098230 |
NDKhoa |
E |
July 15, 2019, 12:55 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
3993600 |
|
2000 |
55959105 |
CNH_FlyingTuwu |
E |
June 23, 2019, 8:45 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
4096000 |
|
2000 |
65055759 |
badassBitch |
E |
Nov. 15, 2019, 3:03 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
7065600 |
|
2000 |
56502105 |
AMnu |
E |
July 4, 2019, 6:49 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
8089600 |
|
2000 |
55830992 |
QAQAutoMaton |
E |
June 20, 2019, 1:07 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
171 |
97382400 |
|
2000 |
62759507 |
MinecraftFuns |
E |
Oct. 17, 2019, 6:20 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
186 |
3993600 |
|
2000 |
56176627 |
zeus_iitg |
E |
June 27, 2019, 7:32 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
186 |
3993600 |
|
2000 |
55856872 |
fengquyoumo |
E |
June 21, 2019, 7:26 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
3993600 |
|
2000 |
55822912 |
Obada-AlAbbadi |
E |
June 20, 2019, 9:24 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
3993600 |
|
2000 |
56055221 |
zahra..d |
E |
June 25, 2019, 10:32 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
4096000 |
|
2000 |
57011462 |
I_Love_Anushak |
E |
July 14, 2019, 9:29 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
4403200 |
|
2000 |
55818153 |
malfple |
E |
June 20, 2019, 7:19 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
8089600 |
|
2000 |
58960895 |
AayushAC1998 |
E |
Aug. 17, 2019, 3:11 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
16076800 |
|
2000 |
58960736 |
AayushAC1998 |
E |
Aug. 17, 2019, 3:06 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
171 |
16076800 |
|
2000 |
57776586 |
Jevrii |
E |
July 26, 2019, 3:54 a.m. |
OK |
GNU C++17 |
TESTS |
44 |
186 |
3993600 |
|
2000 |
57595899 |
Ztrk |
E |
July 23, 2019, 1:55 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
186 |
3993600 |
|
2000 |
56078131 |
zhanghuimeng |
E |
June 26, 2019, 1:49 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
186 |
3993600 |
|
2000 |
56134156 |
filthycasual |
E |
June 26, 2019, 8:30 p.m. |
OK |
Go |
TESTS |
44 |
155 |
209408000 |
|
2000 |
56133978 |
filthycasual |
E |
June 26, 2019, 8:23 p.m. |
OK |
Go |
TESTS |
44 |
171 |
99123200 |
|
2000 |
56133563 |
filthycasual |
E |
June 26, 2019, 8:06 p.m. |
OK |
Go |
TESTS |
44 |
218 |
99123200 |
|
2000 |
55929214 |
filthycasual |
E |
June 22, 2019, 10:41 a.m. |
OK |
Go |
TESTS |
44 |
498 |
117964800 |
|
2000 |
58873595 |
sighduck |
E |
Aug. 15, 2019, 4:37 p.m. |
OK |
Go |
TESTS |
44 |
514 |
137523200 |
|
2000 |
55921238 |
di_halt |
E |
June 22, 2019, 7:32 a.m. |
OK |
Java 8 |
TESTS |
44 |
233 |
4300800 |
|
2000 |
56012139 |
revanthreddy85 |
E |
June 24, 2019, 6:42 p.m. |
OK |
Java 8 |
TESTS |
44 |
248 |
7680000 |
|
2000 |
56444317 |
spar5h |
E |
July 2, 2019, 6:04 p.m. |
OK |
Java 8 |
TESTS |
44 |
248 |
7987200 |
|
2000 |
60483257 |
kusomushi |
E |
Sept. 13, 2019, 11:30 a.m. |
OK |
Java 8 |
TESTS |
44 |
249 |
4300800 |
|
2000 |
59137575 |
beginner1010 |
E |
Aug. 20, 2019, 1:13 p.m. |
OK |
Java 8 |
TESTS |
44 |
265 |
7884800 |
|
2000 |
68102429 |
Xylenox |
E |
Jan. 3, 2020, 4:32 a.m. |
OK |
Java 8 |
TESTS |
44 |
280 |
4300800 |
|
2000 |
56769316 |
yorky |
E |
July 9, 2019, 8:24 p.m. |
OK |
Java 8 |
TESTS |
44 |
280 |
4915200 |
|
2000 |
56545417 |
gaidash |
E |
July 5, 2019, 7:25 a.m. |
OK |
Java 8 |
TESTS |
44 |
295 |
17100800 |
|
2000 |
68702115 |
yaoct |
E |
Jan. 13, 2020, 9:49 a.m. |
OK |
Java 8 |
TESTS |
44 |
296 |
5427200 |
|
2000 |
56770113 |
TheSawan |
E |
July 9, 2019, 8:59 p.m. |
OK |
Java 8 |
TESTS |
44 |
296 |
7987200 |
|
2000 |
62378566 |
vjudge4 |
E |
Oct. 11, 2019, 6:13 p.m. |
OK |
Mono C# |
TESTS |
44 |
233 |
13721600 |
|
2000 |
62380889 |
riantkb |
E |
Oct. 11, 2019, 7:06 p.m. |
OK |
Mono C# |
TESTS |
44 |
234 |
13721600 |
|
2000 |
69504080 |
vjudge5 |
E |
Jan. 25, 2020, 7:47 a.m. |
OK |
MS C++ |
TESTS |
44 |
156 |
4096000 |
|
2000 |
55808753 |
tang0404 |
E |
June 20, 2019, 1:50 a.m. |
OK |
MS C++ |
TESTS |
44 |
187 |
36454400 |
|
2000 |
59097199 |
scorpiowf |
E |
Aug. 19, 2019, 2:39 p.m. |
OK |
MS C++ |
TESTS |
44 |
202 |
4915200 |
|
2000 |
56424165 |
S.K |
E |
July 2, 2019, 8:48 a.m. |
OK |
MS C++ |
TESTS |
44 |
249 |
75571200 |
|
2000 |
56475396 |
vjudge4 |
E |
July 3, 2019, 12:55 p.m. |
OK |
MS C++ |
TESTS |
44 |
389 |
16179200 |
|
2000 |
55806569 |
WoodMachine |
E |
June 19, 2019, 11:11 p.m. |
OK |
MS C++ |
TESTS |
44 |
1387 |
16384000 |
|
2000 |
55916151 |
Owen_H |
E |
June 22, 2019, 5:31 a.m. |
OK |
MS C++ |
TESTS |
44 |
1388 |
3993600 |
|
2000 |
55848722 |
snowdozer |
E |
June 21, 2019, 1:19 a.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
233 |
3993600 |
|
2000 |
60664092 |
pichulia |
E |
Sept. 16, 2019, 6:58 a.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
311 |
4096000 |
|
2000 |
56745512 |
xsc |
E |
July 9, 2019, 9:31 a.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
358 |
4198400 |
|
2000 |
55862103 |
Skeef79 |
E |
June 21, 2019, 10:05 a.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
967 |
4300800 |
|
2000 |
59682538 |
webeseit |
E |
Aug. 29, 2019, 9:49 p.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
1450 |
4300800 |
|
2000 |
56130036 |
filthycasual |
E |
June 26, 2019, 6:21 p.m. |
OK |
Node.js |
TESTS |
44 |
2854 |
173260800 |
|
2000 |
55853074 |
yumtam |
E |
June 21, 2019, 5:24 a.m. |
OK |
PyPy 2 |
TESTS |
44 |
467 |
138956800 |
|
2000 |
56643919 |
Pokeylope |
E |
July 7, 2019, 4:49 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
1278 |
247808000 |
|
2000 |
56068746 |
pineriver |
E |
June 26, 2019, 9:18 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
1387 |
22220800 |
|
2000 |
56252122 |
Akash_123 |
E |
June 29, 2019, 4:06 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
1482 |
103424000 |
|
2000 |
69183243 |
keroru |
E |
Jan. 20, 2020, 11:02 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
1637 |
82739200 |
|
2000 |
56069015 |
pineriver |
E |
June 26, 2019, 9:26 a.m. |
OK |
PyPy 3 |
TESTS |
44 |
1793 |
41881600 |
|
2000 |
57554802 |
Helli.code |
E |
July 22, 2019, 7:07 p.m. |
OK |
Python 2 |
TESTS |
44 |
2729 |
254771200 |
|
2000 |
63366025 |
QuantumKnight |
E |
Oct. 25, 2019, 7:31 a.m. |
OK |
Python 3 |
TESTS |
44 |
3478 |
5120000 |
|
2000 |
remove filters
Back to search problems