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"David was given a red checkered rectangle of size n x m . But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants. As a result, he will get a set of rectangles. Rectangles 1 x 1 are forbidden. David also knows how to paint the cells blue. He wants each rectangle from the resulting set of pieces to be colored such that any pair of adjacent cells by side (from the same piece) have different colors. What is the minimum number of cells David will have to paint? The first line contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers n , m ( 1 <= q n, m <= q 3 cdot 10^4 , n cdot m geq 2 ). For each test case print a single integer -- the minimum number of cells David will have to paint blue. The following pictures show how the initial rectangle can be split and cells colored blue. In the first test case: In the second test case: In the third test case: In the fourth test case: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
135398616 |
Ankit_Sahu_21 |
B |
Nov. 14, 2021, 9:18 a.m. |
OK |
GNU C11 |
TESTS |
11 |
15 |
3686400 |
|
1000 |
135561934 |
jack234232 |
B |
Nov. 15, 2021, 6:02 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135554143 |
liamaking |
B |
Nov. 15, 2021, 3:02 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135548383 |
XZC__Bobby |
B |
Nov. 15, 2021, 2:32 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135521383 |
ZolaWatle |
B |
Nov. 15, 2021, 12:46 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135515608 |
panther_s |
B |
Nov. 14, 2021, 8:55 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135510283 |
farjana_dipa |
B |
Nov. 14, 2021, 7:11 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135506074 |
kartik_garg163 |
B |
Nov. 14, 2021, 6:06 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135498972 |
mdmahfuzalam196 |
B |
Nov. 14, 2021, 4:36 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135491033 |
2020csb1109 |
B |
Nov. 14, 2021, 3:11 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135496312 |
tato12345 |
B |
Nov. 14, 2021, 4:05 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
1000 |
135502395 |
funtastic_envy |
B |
Nov. 14, 2021, 5:18 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
0 |
|
1000 |
135496384 |
rkfcccccc |
B |
Nov. 14, 2021, 4:06 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
0 |
|
1000 |
135352445 |
Absyarka |
B |
Nov. 14, 2021, 6:25 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135421008 |
197R1A05N2saisurya |
B |
Nov. 14, 2021, 12:41 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135375434 |
Polusummator |
B |
Nov. 14, 2021, 7:19 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135374109 |
BIvanV |
B |
Nov. 14, 2021, 7:15 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135358861 |
Gornak40 |
B |
Nov. 14, 2021, 6:37 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135348904 |
SOCIOPATE |
B |
Nov. 14, 2021, 6:19 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
0 |
1024000 |
|
1000 |
135561952 |
Yulia_04 |
B |
Nov. 15, 2021, 6:02 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
15 |
0 |
|
1000 |
135561020 |
aakash.shelake1999 |
B |
Nov. 15, 2021, 5:45 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
15 |
0 |
|
1000 |
135349079 |
imachug |
B |
Nov. 14, 2021, 6:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135403009 |
Eldargv |
B |
Nov. 14, 2021, 9:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135376011 |
segment-tree-enjoyer |
B |
Nov. 14, 2021, 7:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135365416 |
dffTu |
B |
Nov. 14, 2021, 6:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135362087 |
salakhutdinov1 |
B |
Nov. 14, 2021, 6:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135353376 |
knifeman |
B |
Nov. 14, 2021, 6:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135348193 |
grdkrll |
B |
Nov. 14, 2021, 6:17 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135561697 |
Khanjan |
B |
Nov. 15, 2021, 5:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
0 |
|
1000 |
135516206 |
LotusCookie |
B |
Nov. 14, 2021, 9:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
0 |
|
1000 |
135503648 |
JustNik77 |
B |
Nov. 14, 2021, 5:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
0 |
|
1000 |
135376856 |
Robot_X |
B |
Nov. 14, 2021, 7:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135375281 |
Sneper |
B |
Nov. 14, 2021, 7:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135366797 |
IVIN |
B |
Nov. 14, 2021, 6:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135364228 |
EnDeRBeaT |
B |
Nov. 14, 2021, 6:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135355445 |
nizamoff |
B |
Nov. 14, 2021, 6:31 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135351454 |
kolomig0r |
B |
Nov. 14, 2021, 6:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135349713 |
Mihailmm |
B |
Nov. 14, 2021, 6:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135350209 |
Glinomes_3000 |
B |
Nov. 14, 2021, 6:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135392906 |
budushiyprogrammist |
B |
Nov. 14, 2021, 8:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135384758 |
Maxflamesa |
B |
Nov. 14, 2021, 7:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
1228800 |
|
1000 |
135556736 |
Sandy_coder2001 |
B |
Nov. 15, 2021, 4:13 a.m. |
OK |
Java 11 |
TESTS |
11 |
171 |
0 |
|
1000 |
135509080 |
singhshivsm20001 |
B |
Nov. 14, 2021, 6:50 p.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
1000 |
135517793 |
samarpitsachan091 |
B |
Nov. 14, 2021, 9:53 p.m. |
OK |
Java 11 |
TESTS |
11 |
202 |
0 |
|
1000 |
135371977 |
v0s7er |
B |
Nov. 14, 2021, 7:08 a.m. |
OK |
Java 11 |
TESTS |
11 |
218 |
24780800 |
|
1000 |
135425820 |
_Jin_ |
B |
Nov. 14, 2021, 1:25 p.m. |
OK |
Java 11 |
TESTS |
11 |
233 |
0 |
|
1000 |
135363942 |
RedDime |
B |
Nov. 14, 2021, 6:48 a.m. |
OK |
Java 11 |
TESTS |
11 |
249 |
25395200 |
|
1000 |
135358323 |
g0dzilla |
B |
Nov. 14, 2021, 6:36 a.m. |
OK |
Java 8 |
TESTS |
11 |
170 |
19558400 |
|
1000 |
135351577 |
_Astron |
B |
Nov. 14, 2021, 6:24 a.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
124 |
19660800 |
|
1000 |
135377275 |
Dimitrys |
B |
Nov. 14, 2021, 7:25 a.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
171 |
19558400 |
|
1000 |
135391153 |
Koo_Pung-Kei |
B |
Nov. 14, 2021, 8:14 a.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
265 |
26112000 |
|
1000 |
135384294 |
Plkhvl |
B |
Nov. 14, 2021, 7:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135380059 |
setday |
B |
Nov. 14, 2021, 7:34 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135417820 |
Maksss |
B |
Nov. 14, 2021, 12:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135417691 |
Maksss |
B |
Nov. 14, 2021, 12:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135417363 |
Maksss |
B |
Nov. 14, 2021, 12:08 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135416326 |
SusikXD |
B |
Nov. 14, 2021, 11:59 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135391819 |
Subio |
B |
Nov. 14, 2021, 8:16 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135389685 |
Miximka |
B |
Nov. 14, 2021, 8:10 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135388200 |
may.bee |
B |
Nov. 14, 2021, 8:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135385263 |
Slivanovich |
B |
Nov. 14, 2021, 7:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
15 |
1126400 |
|
1000 |
135367846 |
maxusD |
B |
Nov. 14, 2021, 6:57 a.m. |
OK |
.NET Core C# |
TESTS |
11 |
92 |
8704000 |
|
1000 |
135385573 |
reosfire |
B |
Nov. 14, 2021, 7:55 a.m. |
OK |
.NET Core C# |
TESTS |
11 |
108 |
8908800 |
|
1000 |
135384367 |
vitaliy101 |
B |
Nov. 14, 2021, 7:50 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
124 |
20684800 |
|
1000 |
135366523 |
anontot |
B |
Nov. 14, 2021, 6:54 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
124 |
20684800 |
|
1000 |
135354697 |
Konobeitsev_Ivan |
B |
Nov. 14, 2021, 6:29 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
124 |
20787200 |
|
1000 |
135363710 |
Darksy125 |
B |
Nov. 14, 2021, 6:47 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
139 |
20480000 |
|
1000 |
135353039 |
timerglOoOt |
B |
Nov. 14, 2021, 6:26 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
139 |
20582400 |
|
1000 |
135479027 |
pskobx |
B |
Nov. 14, 2021, 2:12 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
140 |
2969600 |
|
1000 |
135533366 |
chiakimio |
B |
Nov. 15, 2021, 2:17 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
140 |
3072000 |
|
1000 |
135360470 |
SoSya |
B |
Nov. 14, 2021, 6:40 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
140 |
20377600 |
|
1000 |
135387266 |
sofiya-nes |
B |
Nov. 14, 2021, 8:01 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
140 |
20582400 |
|
1000 |
135372071 |
mitya21052004 |
B |
Nov. 14, 2021, 7:09 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
140 |
20582400 |
|
1000 |
135500593 |
RiddhiAher |
B |
Nov. 14, 2021, 4:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
77 |
2457600 |
|
1000 |
135347086 |
_heqzagone_ |
B |
Nov. 14, 2021, 6:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
77 |
30617600 |
|
1000 |
135558051 |
mnkp |
B |
Nov. 15, 2021, 4:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
4403200 |
|
1000 |
135521319 |
DippleThree |
B |
Nov. 15, 2021, 12:45 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
4403200 |
|
1000 |
135558823 |
PhamNguyen |
B |
Nov. 15, 2021, 5:01 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
4608000 |
|
1000 |
135379909 |
volkivpered |
B |
Nov. 14, 2021, 7:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
32563200 |
|
1000 |
135382037 |
ITManiac |
B |
Nov. 14, 2021, 7:41 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
32665600 |
|
1000 |
135345188 |
otter_18 |
B |
Nov. 14, 2021, 6:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
32768000 |
|
1000 |
135380999 |
Kalachin_Alexey |
B |
Nov. 14, 2021, 7:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
32972800 |
|
1000 |
135370734 |
Maltsev_Kir |
B |
Nov. 14, 2021, 7:05 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
32972800 |
|
1000 |
135499626 |
Melita. |
B |
Nov. 14, 2021, 4:44 p.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
0 |
|
1000 |
135495927 |
osm05 |
B |
Nov. 14, 2021, 4:01 p.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
0 |
|
1000 |
135492082 |
Pasha_Rodygin |
B |
Nov. 14, 2021, 3:22 p.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
0 |
|
1000 |
135491398 |
omn |
B |
Nov. 14, 2021, 3:15 p.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
0 |
|
1000 |
135412594 |
MohammadsadraSedighin |
B |
Nov. 14, 2021, 11:23 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4300800 |
|
1000 |
135405702 |
NAVEEDAHMED |
B |
Nov. 14, 2021, 10:21 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4300800 |
|
1000 |
135361377 |
Andmine |
B |
Nov. 14, 2021, 6:42 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4300800 |
|
1000 |
135357150 |
SerafimVS |
B |
Nov. 14, 2021, 6:34 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4300800 |
|
1000 |
135349841 |
Cap_obvious |
B |
Nov. 14, 2021, 6:20 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4300800 |
|
1000 |
135405434 |
de_adinside |
B |
Nov. 14, 2021, 10:18 a.m. |
OK |
Python 3 |
TESTS |
11 |
46 |
4505600 |
|
1000 |
remove filters
Back to search problems