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"There is a square grid of size n x n . Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs max(h, w) to color a rectangle of size h x w . You are to make all cells white for minimum total cost. The first line contains a single integer n ( 1 <= q n <= q 50 ) -- the size of the square grid. Each of the next n lines contains a string of length n , consisting of characters '.' and '#'. The j -th character of the i -th line is '#' if the cell with coordinates (i, j) is black, otherwise it is white. Print a single integer -- the minimum total cost to paint all cells in white. The examples and some of optimal solutions are shown on the pictures below. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
58026869 |
Gassa |
D |
July 30, 2019, 4:14 p.m. |
OK |
D |
TESTS |
43 |
468 |
13516800 |
|
2400 |
57998465 |
hos.lyric |
D |
July 30, 2019, 2:48 p.m. |
OK |
D |
TESTS |
43 |
748 |
37068800 |
|
2400 |
60241577 |
MK._. |
D |
Sept. 7, 2019, 9:46 p.m. |
OK |
GNU C11 |
TESTS |
46 |
373 |
24985600 |
|
2400 |
58120389 |
smit.mangukiya |
D |
Aug. 1, 2019, 10:28 a.m. |
OK |
GNU C11 |
TESTS |
46 |
421 |
36659200 |
|
2400 |
58120463 |
smit.mangukiya |
D |
Aug. 1, 2019, 10:30 a.m. |
OK |
GNU C11 |
TESTS |
46 |
748 |
36659200 |
|
2400 |
58120543 |
smit.mangukiya |
D |
Aug. 1, 2019, 10:32 a.m. |
OK |
GNU C11 |
TESTS |
46 |
795 |
36659200 |
|
2400 |
58881809 |
haas |
D |
Aug. 15, 2019, 9:47 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
46 |
52019200 |
|
2400 |
58493431 |
vjudge4 |
D |
Aug. 9, 2019, 11:04 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
62 |
512000 |
|
2400 |
58057620 |
SidneySun |
D |
July 31, 2019, 6:05 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
77 |
29081600 |
|
2400 |
58495478 |
vjudge5 |
D |
Aug. 9, 2019, 11:58 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
78 |
716800 |
|
2400 |
58691766 |
ouqingliang |
D |
Aug. 13, 2019, 3:35 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
78 |
29286400 |
|
2400 |
58016796 |
lk_ZeroMaker |
D |
July 30, 2019, 3:38 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
93 |
31334400 |
|
2400 |
58223963 |
cuizhuyefei |
D |
Aug. 3, 2019, 1:42 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
36659200 |
|
2400 |
58197483 |
luogu_bot2 |
D |
Aug. 3, 2019, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
36659200 |
|
2400 |
58889005 |
Notseefire |
D |
Aug. 16, 2019, 4:14 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
36659200 |
|
2400 |
58048429 |
caoyue |
D |
July 31, 2019, 1:29 a.m. |
OK |
GNU C++11 |
TESTS |
44 |
93 |
42393600 |
|
2400 |
58023943 |
soros666 |
D |
July 30, 2019, 4:03 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
46 |
27238400 |
|
2400 |
58038549 |
pikmike |
D |
July 30, 2019, 6:42 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
46 |
42496000 |
|
2400 |
58035904 |
Giver |
D |
July 30, 2019, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
62 |
36659200 |
|
2400 |
58625192 |
_h_ |
D |
Aug. 11, 2019, 5:10 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
93 |
6963200 |
|
2400 |
65924027 |
step_by_step |
D |
Nov. 28, 2019, 5:28 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
93 |
25190400 |
|
2400 |
58034749 |
Linkus |
D |
July 30, 2019, 5:52 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
93 |
25190400 |
|
2400 |
58003645 |
pashka |
D |
July 30, 2019, 2:59 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
93 |
25190400 |
|
2400 |
58070846 |
smtcoder |
D |
July 31, 2019, 10:36 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
93 |
27136000 |
|
2400 |
58192206 |
Hasan0540 |
D |
Aug. 2, 2019, 8:23 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
93 |
27238400 |
|
2400 |
58129771 |
HynDuf |
D |
Aug. 1, 2019, 1:50 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
93 |
29491200 |
|
2400 |
58027881 |
flashmt |
D |
July 30, 2019, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
1331200 |
|
2400 |
58030286 |
pllk |
D |
July 30, 2019, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
73523200 |
|
2400 |
58039307 |
flashmt |
D |
July 30, 2019, 6:59 p.m. |
OK |
GNU C++17 |
TESTS |
44 |
46 |
1331200 |
|
2400 |
58976262 |
kamer |
D |
Aug. 18, 2019, 1:09 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
46 |
25292800 |
|
2400 |
61050745 |
eidan |
D |
Sept. 22, 2019, 6:24 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
62 |
3891200 |
|
2400 |
58678103 |
Jungarr1k |
D |
Aug. 12, 2019, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
77 |
27238400 |
|
2400 |
58008815 |
Atreus |
D |
July 30, 2019, 3:13 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
78 |
29491200 |
|
2400 |
65071400 |
JORGE_E |
D |
Nov. 15, 2019, 4:46 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
78 |
29491200 |
|
2400 |
58095559 |
The.Last.Wizard |
D |
July 31, 2019, 7:36 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
93 |
25088000 |
|
2400 |
58014549 |
300iq |
D |
July 30, 2019, 3:31 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
93 |
25088000 |
|
2400 |
58012400 |
qwerty787788 |
D |
July 30, 2019, 3:24 p.m. |
OK |
Java 8 |
TESTS |
43 |
342 |
0 |
|
2400 |
58035555 |
fetetriste |
D |
July 30, 2019, 5:59 p.m. |
OK |
Java 8 |
TESTS |
44 |
467 |
38195200 |
|
2400 |
58974651 |
happybelly |
D |
Aug. 17, 2019, 11:14 p.m. |
OK |
Java 8 |
TESTS |
46 |
483 |
38195200 |
|
2400 |
58505311 |
TheDarBear |
D |
Aug. 9, 2019, 4:10 p.m. |
OK |
Java 8 |
TESTS |
46 |
483 |
38707200 |
|
2400 |
58035469 |
fetetriste |
D |
July 30, 2019, 5:58 p.m. |
OK |
Java 8 |
TESTS |
44 |
530 |
38297600 |
|
2400 |
59837724 |
huhansan |
D |
Sept. 1, 2019, 5:28 a.m. |
OK |
Java 8 |
TESTS |
46 |
561 |
0 |
|
2400 |
58188836 |
guillermo_sz |
D |
Aug. 2, 2019, 6:25 p.m. |
OK |
Java 8 |
TESTS |
46 |
561 |
0 |
|
2400 |
58015214 |
Petr |
D |
July 30, 2019, 3:33 p.m. |
OK |
Java 8 |
TESTS |
43 |
576 |
0 |
|
2400 |
58021261 |
Egor |
D |
July 30, 2019, 3:53 p.m. |
OK |
Java 8 |
TESTS |
43 |
577 |
38092800 |
|
2400 |
58974312 |
happybelly |
D |
Aug. 17, 2019, 10:51 p.m. |
OK |
Java 8 |
TESTS |
46 |
623 |
37990400 |
|
2400 |
58460412 |
darnley |
D |
Aug. 8, 2019, 4:05 p.m. |
OK |
Kotlin |
TESTS |
46 |
623 |
40140800 |
|
2400 |
58018931 |
darnley |
D |
July 30, 2019, 3:45 p.m. |
OK |
Kotlin |
TESTS |
43 |
716 |
40140800 |
|
2400 |
58032133 |
riantkb |
D |
July 30, 2019, 4:33 p.m. |
OK |
Mono C# |
TESTS |
43 |
124 |
34816000 |
|
2400 |
58097319 |
claw88 |
D |
July 31, 2019, 8:44 p.m. |
OK |
Mono C# |
TESTS |
46 |
514 |
26214400 |
|
2400 |
58097302 |
claw88 |
D |
July 31, 2019, 8:44 p.m. |
OK |
Mono C# |
TESTS |
46 |
545 |
26214400 |
|
2400 |
58493735 |
vjudge1 |
D |
Aug. 9, 2019, 11:13 a.m. |
OK |
MS C++ |
TESTS |
46 |
265 |
52019200 |
|
2400 |
58539784 |
vjudge3 |
D |
Aug. 10, 2019, 1:37 p.m. |
OK |
MS C++ |
TESTS |
46 |
499 |
36659200 |
|
2400 |
58538961 |
vjudge1 |
D |
Aug. 10, 2019, 1:14 p.m. |
OK |
MS C++ |
TESTS |
46 |
608 |
36659200 |
|
2400 |
62253712 |
vjudge4 |
D |
Oct. 10, 2019, 10:07 a.m. |
OK |
MS C++ |
TESTS |
46 |
951 |
42291200 |
|
2400 |
58268566 |
TOXait |
D |
Aug. 4, 2019, 3:48 p.m. |
OK |
MS C++ 2017 |
TESTS |
46 |
139 |
36659200 |
|
2400 |
58036944 |
Milanin |
D |
July 30, 2019, 6:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
44 |
140 |
36659200 |
|
2400 |
59243977 |
dandf |
D |
Aug. 21, 2019, 9:39 p.m. |
OK |
MS C++ 2017 |
TESTS |
46 |
483 |
25088000 |
|
2400 |
58091579 |
yorky |
D |
July 31, 2019, 5:47 p.m. |
OK |
MS C++ 2017 |
TESTS |
45 |
483 |
27136000 |
|
2400 |
68856704 |
AleksanderBalobanov |
D |
Jan. 15, 2020, 10:52 a.m. |
OK |
MS C++ 2017 |
TESTS |
46 |
499 |
96460800 |
|
2400 |
58070786 |
index_ |
D |
July 31, 2019, 10:34 a.m. |
OK |
MS C++ 2017 |
TESTS |
45 |
857 |
54272000 |
|
2400 |
58029707 |
EbTech |
D |
July 30, 2019, 4:25 p.m. |
OK |
Rust |
TESTS |
43 |
358 |
8601600 |
|
2400 |
58680188 |
sansen |
D |
Aug. 12, 2019, 6:31 p.m. |
OK |
Rust |
TESTS |
46 |
421 |
8499200 |
|
2400 |
58679903 |
sansen |
D |
Aug. 12, 2019, 6:23 p.m. |
OK |
Rust |
TESTS |
46 |
748 |
29593600 |
|
2400 |
58082123 |
YeXiaoRain |
D |
July 31, 2019, 2:14 p.m. |
OK |
Rust |
TESTS |
45 |
920 |
30720000 |
|
2400 |
58081703 |
YeXiaoRain |
D |
July 31, 2019, 2:07 p.m. |
OK |
Rust |
TESTS |
45 |
966 |
30720000 |
|
2400 |
remove filters
Back to search problems