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"You have an image file of size 2 x 2 , consisting of 4 pixels. Each pixel can have one of 26 different colors, denoted by lowercase Latin letters. You want to recolor some of the pixels of the image so that all 4 pixels have the same color. In one move, you can choose no more than two pixels of the same color and paint them into some other color (if you choose two pixels, both should be painted into the same color). What is the minimum number of moves you have to make in order to fulfill your goal? The first line contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. Each test case consists of two lines. Each of these lines contains two lowercase letters of Latin alphabet without any separators, denoting a row of pixels in the image. For each test case, print one integer -- the minimum number of moves you have to make so that all 4 pixels of the image have the same color. Let's analyze the test cases of the example. In the first test case, you can paint the bottom left pixel and the top right pixel (which share the same color) into the color r, so all pixels have this color. In the second test case, two moves are enough: In the third test case, all pixels already have the same color. In the fourth test case, you may leave any of the pixels unchanged, and paint all three other pixels into the color of that pixel in three moves. In the fifth test case, you can paint both top pixels into the color x. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
169927444 |
arafamin |
A |
Aug. 28, 2022, 2:29 a.m. |
OK |
C# 8 |
TESTS |
2 |
62 |
204800 |
|
|
169901882 |
rakeshkundankps |
A |
Aug. 27, 2022, 5:48 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
169894622 |
abhi.strike |
A |
Aug. 27, 2022, 4:52 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
169926845 |
vjudge3 |
A |
Aug. 28, 2022, 2:17 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
2 |
31 |
0 |
|
|
169905766 |
skrrrr |
A |
Aug. 27, 2022, 6:27 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
169889837 |
Babul_sec |
A |
Aug. 27, 2022, 4:33 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
169900845 |
garmoosh |
A |
Aug. 27, 2022, 5:39 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
169888316 |
KingKai_Coder |
A |
Aug. 27, 2022, 4:31 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
169901606 |
moneem_ahmed |
A |
Aug. 27, 2022, 5:46 p.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
0 |
|
|
169938803 |
you_dit |
A |
Aug. 28, 2022, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169936150 |
greatFERRARIMASTERbLAN |
A |
Aug. 28, 2022, 5:19 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169938463 |
Lazy23 |
A |
Aug. 28, 2022, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169938159 |
Dumped |
A |
Aug. 28, 2022, 5:49 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169938011 |
myee |
A |
Aug. 28, 2022, 5:46 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169937968 |
Nageswara |
A |
Aug. 28, 2022, 5:46 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169937746 |
vasvisood |
A |
Aug. 28, 2022, 5:43 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169937620 |
jersyguy |
A |
Aug. 28, 2022, 5:41 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169937418 |
Nafisraza |
A |
Aug. 28, 2022, 5:38 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169936269 |
asal.jahanshiri |
A |
Aug. 28, 2022, 5:21 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
169938433 |
harshmishra061 |
A |
Aug. 28, 2022, 5:53 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169938183 |
Cauchy-Euler8900 |
A |
Aug. 28, 2022, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169938068 |
h_coding_cat |
A |
Aug. 28, 2022, 5:47 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169937876 |
prasads_cf |
A |
Aug. 28, 2022, 5:45 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169937871 |
kumarabhishek0776 |
A |
Aug. 28, 2022, 5:45 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169937736 |
ac2u |
A |
Aug. 28, 2022, 5:43 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169938821 |
shubham45sonar |
A |
Aug. 28, 2022, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169938986 |
SaiSrujan7 |
A |
Aug. 28, 2022, 6 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169939032 |
heyharry |
A |
Aug. 28, 2022, 6 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169939082 |
dalek114514 |
A |
Aug. 28, 2022, 6:01 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
169925218 |
fushan |
A |
Aug. 28, 2022, 1:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169936562 |
HydrO7gen |
A |
Aug. 28, 2022, 5:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169936297 |
HydrO7gen |
A |
Aug. 28, 2022, 5:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169933274 |
mahfoozhaq189 |
A |
Aug. 28, 2022, 4:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169929490 |
Feintl |
A |
Aug. 28, 2022, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169928122 |
Double_pipe_dream |
A |
Aug. 28, 2022, 2:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169927416 |
shubham_1806 |
A |
Aug. 28, 2022, 2:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169926390 |
Late_Beginner |
A |
Aug. 28, 2022, 2:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169926052 |
-wicton- |
A |
Aug. 28, 2022, 2 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169924176 |
PCC |
A |
Aug. 28, 2022, 1:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
169938012 |
alighasemi |
A |
Aug. 28, 2022, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169937963 |
hect123 |
A |
Aug. 28, 2022, 5:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169937857 |
xjq |
A |
Aug. 28, 2022, 5:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169937838 |
anhthupascal |
A |
Aug. 28, 2022, 5:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169937402 |
Hh_woman |
A |
Aug. 28, 2022, 5:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169937216 |
fan_of_tourist |
A |
Aug. 28, 2022, 5:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169938188 |
Ram0553 |
A |
Aug. 28, 2022, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169938395 |
Harek |
A |
Aug. 28, 2022, 5:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169938680 |
trafik |
A |
Aug. 28, 2022, 5:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169938823 |
Akash_singhal |
A |
Aug. 28, 2022, 5:58 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
169936276 |
aayushdhakad |
A |
Aug. 28, 2022, 5:22 a.m. |
OK |
Java 11 |
TESTS |
2 |
155 |
0 |
|
|
169913511 |
harshiteuro |
A |
Aug. 27, 2022, 8:20 p.m. |
OK |
Java 11 |
TESTS |
2 |
155 |
0 |
|
|
169910596 |
lock_infinity |
A |
Aug. 27, 2022, 7:31 p.m. |
OK |
Java 11 |
TESTS |
2 |
155 |
0 |
|
|
169894976 |
ryder890 |
A |
Aug. 27, 2022, 4:54 p.m. |
OK |
Java 11 |
TESTS |
2 |
155 |
0 |
|
|
169930666 |
Never_Give_Up_Mani |
A |
Aug. 28, 2022, 3:31 a.m. |
OK |
Java 11 |
TESTS |
2 |
170 |
0 |
|
|
169898166 |
shivgarg321 |
A |
Aug. 27, 2022, 5:16 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
169904567 |
rajneesh.osho |
A |
Aug. 27, 2022, 6:15 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
169901423 |
princeayush04 |
A |
Aug. 27, 2022, 5:44 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
169896929 |
hemant14050 |
A |
Aug. 27, 2022, 5:07 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
169939143 |
rajstormo |
A |
Aug. 28, 2022, 6:01 a.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
0 |
|
|
169900271 |
Paraboyyyy |
A |
Aug. 27, 2022, 5:34 p.m. |
OK |
Java 17 |
TESTS |
2 |
139 |
0 |
|
|
169912517 |
umesh08 |
A |
Aug. 27, 2022, 8:02 p.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
1126400 |
|
|
169892670 |
pandeyanubhav888 |
A |
Aug. 27, 2022, 4:42 p.m. |
OK |
Java 17 |
TESTS |
2 |
186 |
102400 |
|
|
169893102 |
Kamal_15 |
A |
Aug. 27, 2022, 4:44 p.m. |
OK |
Java 17 |
TESTS |
2 |
202 |
0 |
|
|
169905457 |
AdityaGupta19 |
A |
Aug. 27, 2022, 6:24 p.m. |
OK |
Java 17 |
TESTS |
2 |
202 |
102400 |
|
|
169932878 |
CrinklyGolem |
A |
Aug. 28, 2022, 4:19 a.m. |
OK |
Java 17 |
TESTS |
2 |
218 |
307200 |
|
|
169898965 |
tanya_15 |
A |
Aug. 27, 2022, 5:23 p.m. |
OK |
Java 17 |
TESTS |
2 |
233 |
102400 |
|
|
169898662 |
tanya_15 |
A |
Aug. 27, 2022, 5:20 p.m. |
OK |
Java 17 |
TESTS |
2 |
233 |
512000 |
|
|
169917786 |
Kharouba |
A |
Aug. 27, 2022, 9:50 p.m. |
OK |
Java 8 |
TESTS |
2 |
77 |
0 |
|
|
169909432 |
Yousef_Badr |
A |
Aug. 27, 2022, 7:13 p.m. |
OK |
Java 8 |
TESTS |
2 |
77 |
0 |
|
|
169898345 |
AFouad204 |
A |
Aug. 27, 2022, 5:18 p.m. |
OK |
Java 8 |
TESTS |
2 |
77 |
0 |
|
|
169920946 |
Sussykin |
A |
Aug. 27, 2022, 11:29 p.m. |
OK |
Java 8 |
TESTS |
2 |
78 |
0 |
|
|
169911469 |
Kritika717 |
A |
Aug. 27, 2022, 7:45 p.m. |
OK |
Java 8 |
TESTS |
2 |
92 |
0 |
|
|
169891880 |
ahmedTarek28 |
A |
Aug. 27, 2022, 4:39 p.m. |
OK |
Java 8 |
TESTS |
2 |
92 |
0 |
|
|
169908688 |
Mustafa__ |
A |
Aug. 27, 2022, 7:03 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
169907538 |
adi_7861 |
A |
Aug. 27, 2022, 6:47 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
169904519 |
aswad2 |
A |
Aug. 27, 2022, 6:15 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
169903777 |
BhargavModha |
A |
Aug. 27, 2022, 6:07 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
169896653 |
abhivarma209 |
A |
Aug. 27, 2022, 5:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
0 |
|
|
169917198 |
Vovi_Ti |
A |
Aug. 27, 2022, 9:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
15 |
0 |
|
|
169899057 |
cptahahab |
A |
Aug. 27, 2022, 5:24 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
15 |
0 |
|
|
169892669 |
divyansh14 |
A |
Aug. 27, 2022, 4:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
15 |
0 |
|
|
169898899 |
cptahahab |
A |
Aug. 27, 2022, 5:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
30 |
0 |
|
|
169895883 |
1_2_3_4_5_9 |
A |
Aug. 27, 2022, 5 p.m. |
OK |
PyPy 2 |
TESTS |
2 |
93 |
7168000 |
|
|
169892271 |
abineth |
A |
Aug. 27, 2022, 4:41 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
61 |
1843200 |
|
|
169927251 |
udayan8 |
A |
Aug. 28, 2022, 2:25 a.m. |
OK |
PyPy 3 |
TESTS |
2 |
92 |
1331200 |
|
|
169897928 |
At0m0verr1de |
A |
Aug. 27, 2022, 5:14 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
139 |
4915200 |
|
|
169919600 |
Shanko |
A |
Aug. 27, 2022, 10:44 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
155 |
4096000 |
|
|
169904650 |
Su_123 |
A |
Aug. 27, 2022, 6:16 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
155 |
4096000 |
|
|
169912447 |
Shristi02 |
A |
Aug. 27, 2022, 8:01 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
156 |
4198400 |
|
|
169887589 |
swathi18melapu |
A |
Aug. 27, 2022, 4:30 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
156 |
4198400 |
|
|
169930750 |
Nandhan_8374 |
A |
Aug. 28, 2022, 3:32 a.m. |
OK |
PyPy 3 |
TESTS |
2 |
170 |
4710400 |
|
|
169919254 |
crapcode |
A |
Aug. 27, 2022, 10:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
46 |
1945600 |
|
|
169937481 |
NINGucas |
A |
Aug. 28, 2022, 5:39 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
46 |
2662400 |
|
|
169903061 |
gesuta |
A |
Aug. 27, 2022, 6 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
62 |
1945600 |
|
|
169906583 |
kavorka |
A |
Aug. 27, 2022, 6:36 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
62 |
2252800 |
|
|
169894450 |
sjNxksbzj |
A |
Aug. 27, 2022, 4:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
3072000 |
|
|
169938350 |
farrellbyu |
A |
Aug. 28, 2022, 5:52 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
3584000 |
|
|
169917805 |
mnkp |
A |
Aug. 27, 2022, 9:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
93 |
3481600 |
|
|
169898639 |
bronze_coder |
A |
Aug. 27, 2022, 5:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
93 |
6656000 |
|
|
169929210 |
terasa |
A |
Aug. 28, 2022, 3:02 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
108 |
3481600 |
|
|
169904391 |
Noobmaster_64 |
A |
Aug. 27, 2022, 6:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
108 |
5529600 |
|
|
169932879 |
machonium |
A |
Aug. 28, 2022, 4:19 a.m. |
OK |
Python 3 |
TESTS |
2 |
15 |
0 |
|
|
169899515 |
rostoki |
A |
Aug. 27, 2022, 5:27 p.m. |
OK |
Python 3 |
TESTS |
2 |
15 |
102400 |
|
|
169935496 |
Mahad_SundarSTEM |
A |
Aug. 28, 2022, 5:09 a.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169928626 |
psyborg28 |
A |
Aug. 28, 2022, 2:52 a.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169917949 |
Jonyi |
A |
Aug. 27, 2022, 9:54 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169907233 |
batchupuneeth2003 |
A |
Aug. 27, 2022, 6:44 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169904275 |
monkey_noises |
A |
Aug. 27, 2022, 6:12 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169900070 |
SreeHarshith |
A |
Aug. 27, 2022, 5:32 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169896108 |
nikhila479 |
A |
Aug. 27, 2022, 5:01 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169893043 |
roshan_kumar |
A |
Aug. 27, 2022, 4:44 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
169918312 |
kobae964 |
A |
Aug. 27, 2022, 10:04 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
0 |
102400 |
|
|
remove filters
Back to search problems