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 are given an array of n integers, where each integer is either 0 , 1 , or 2 . Initially, each element of the array is blue. Your goal is to paint each element of the array red. In order to do so, you can perform operations of two types: What is the minimum number of coins you have to spend to achieve your goal? The first line contains one integer n ( 1 <= n <= 2 cdot 10^5 ). The second line contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 2 ). Print one integer -- the minimum number of coins you have to spend in order to paint all elements red. In the first example, you can paint all elements red with having to spend only one coin as follows: In the second example, you can paint all elements red spending only two coins as follows: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
216023911 |
Mohammad-Reza |
D |
July 28, 2023, 12:53 a.m. |
OK |
C# 10 |
TESTS |
52 |
61 |
15462400 |
|
|
215986611 |
SKAPhantom |
D |
July 27, 2023, 4:58 p.m. |
OK |
D |
TESTS |
52 |
78 |
4198400 |
|
|
216009888 |
Lil_Dankakon |
D |
July 27, 2023, 8:31 p.m. |
OK |
GNU C11 |
TESTS |
52 |
46 |
3993600 |
|
|
216009870 |
Lil_Dankakon |
D |
July 27, 2023, 8:30 p.m. |
OK |
GNU C11 |
TESTS |
52 |
46 |
3993600 |
|
|
215985827 |
a999999 |
D |
July 27, 2023, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
30 |
10752000 |
|
|
216029004 |
XZQOvO |
D |
July 28, 2023, 2:07 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
819200 |
|
|
216023816 |
Adp_D |
D |
July 28, 2023, 12:51 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
1024000 |
|
|
216027851 |
snowca |
D |
July 28, 2023, 1:50 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
1843200 |
|
|
216030110 |
CRT |
D |
July 28, 2023, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
2457600 |
|
|
216042491 |
whdywjd |
D |
July 28, 2023, 5:03 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
2560000 |
|
|
216034085 |
OMG_78 |
D |
July 28, 2023, 3:11 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
3276800 |
|
|
216024204 |
greenhand.n |
D |
July 28, 2023, 12:58 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
46 |
819200 |
|
|
216025342 |
luogu_bot5 |
D |
July 28, 2023, 1:16 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
46 |
819200 |
|
|
216028856 |
yuzou |
D |
July 28, 2023, 2:05 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
46 |
819200 |
|
|
216032309 |
yeVegetable |
D |
July 28, 2023, 2:49 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
819200 |
|
|
216039931 |
bobthestickman |
D |
July 28, 2023, 4:27 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
2150400 |
|
|
216040146 |
yangjintian123 |
D |
July 28, 2023, 4:30 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
3379200 |
|
|
215991620 |
Syoumzic |
D |
July 27, 2023, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
0 |
|
|
215988201 |
sun08 |
D |
July 27, 2023, 5:08 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
0 |
|
|
216041589 |
leesin5202 |
D |
July 28, 2023, 4:51 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
|
216040305 |
Rhyme3 |
D |
July 28, 2023, 4:32 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
|
216036089 |
Spring.A |
D |
July 28, 2023, 3:38 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
|
216047241 |
swetank_1508 |
D |
July 28, 2023, 6:01 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
|
216045641 |
Akshay184 |
D |
July 28, 2023, 5:42 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
|
215996524 |
wqweto |
D |
July 27, 2023, 6:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
819200 |
|
|
215986586 |
Almaz45 |
D |
July 27, 2023, 4:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
819200 |
|
|
216000221 |
fwxlj_ |
D |
July 27, 2023, 6:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
1638400 |
|
|
215988154 |
illume2021 |
D |
July 27, 2023, 5:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
1638400 |
|
|
215984565 |
suzuken_w |
D |
July 27, 2023, 4:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
1638400 |
|
|
216043928 |
luogu_bot5 |
D |
July 28, 2023, 5:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
1638400 |
|
|
216023275 |
flyfly |
D |
July 28, 2023, 12:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
1638400 |
|
|
215999941 |
apostoldaniel854 |
D |
July 27, 2023, 6:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
2457600 |
|
|
215982486 |
arujbansal |
D |
July 27, 2023, 4:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
4505600 |
|
|
216014597 |
enslaved |
D |
July 27, 2023, 9:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
52 |
31 |
4812800 |
|
|
215984415 |
ProgrammMaster |
D |
July 27, 2023, 4:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
15 |
0 |
|
|
216032539 |
uuku |
D |
July 28, 2023, 2:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
15 |
4505600 |
|
|
215990840 |
marwanSameh |
D |
July 27, 2023, 5:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
216046879 |
li_yuang |
D |
July 28, 2023, 5:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
215982424 |
Me0wtiply |
D |
July 27, 2023, 4:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
215992104 |
Osmabnlden |
D |
July 27, 2023, 5:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
216037996 |
manik_2021336 |
D |
July 28, 2023, 4:02 a.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
215990451 |
DKAZ |
D |
July 27, 2023, 5:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
0 |
|
|
216045288 |
kar2003 |
D |
July 28, 2023, 5:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
819200 |
|
|
216046751 |
tukohh |
D |
July 28, 2023, 5:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
52 |
31 |
819200 |
|
|
216035316 |
cck111 |
D |
July 28, 2023, 3:28 a.m. |
OK |
Go |
TESTS |
52 |
62 |
1638400 |
|
|
215986964 |
lorenzotinfena |
D |
July 27, 2023, 5 p.m. |
OK |
Go |
TESTS |
52 |
93 |
11468800 |
|
|
215987490 |
shojin_pro |
D |
July 27, 2023, 5:04 p.m. |
OK |
Java 11 |
TESTS |
52 |
186 |
0 |
|
|
216016874 |
Yousef_Badr |
D |
July 27, 2023, 10:22 p.m. |
OK |
Java 11 |
TESTS |
52 |
187 |
0 |
|
|
216016758 |
Yousef_Badr |
D |
July 27, 2023, 10:19 p.m. |
OK |
Java 11 |
TESTS |
52 |
187 |
0 |
|
|
216007713 |
themadknight45 |
D |
July 27, 2023, 8:04 p.m. |
OK |
Java 11 |
TESTS |
52 |
187 |
0 |
|
|
216002710 |
dzhi |
D |
July 27, 2023, 7:07 p.m. |
OK |
Java 11 |
TESTS |
52 |
202 |
0 |
|
|
216002491 |
dzhi |
D |
July 27, 2023, 7:05 p.m. |
OK |
Java 11 |
TESTS |
52 |
202 |
0 |
|
|
216032730 |
karamkontar |
D |
July 28, 2023, 2:54 a.m. |
OK |
Java 11 |
TESTS |
52 |
327 |
34611200 |
|
|
216027678 |
HMETAO |
D |
July 28, 2023, 1:48 a.m. |
OK |
Java 17 |
TESTS |
52 |
233 |
7577600 |
|
|
215984295 |
sagnikghoshcr7 |
D |
July 27, 2023, 4:47 p.m. |
OK |
Java 17 |
TESTS |
52 |
249 |
716800 |
|
|
216045065 |
AKhacks |
D |
July 28, 2023, 5:35 a.m. |
OK |
Java 17 |
TESTS |
52 |
265 |
409600 |
|
|
216021320 |
mcrash12 |
D |
July 28, 2023, 12:01 a.m. |
OK |
Java 17 |
TESTS |
52 |
280 |
409600 |
|
|
215984965 |
ffaann |
D |
July 27, 2023, 4:50 p.m. |
OK |
Java 17 |
TESTS |
52 |
296 |
15257600 |
|
|
216014112 |
Sam5 |
D |
July 27, 2023, 9:33 p.m. |
OK |
Java 17 |
TESTS |
52 |
514 |
48844800 |
|
|
216023656 |
Eslam_Ahmed |
D |
July 28, 2023, 12:49 a.m. |
OK |
Java 8 |
TESTS |
52 |
124 |
0 |
|
|
216037079 |
Java_Programmer |
D |
July 28, 2023, 3:50 a.m. |
OK |
Java 8 |
TESTS |
52 |
140 |
0 |
|
|
215986936 |
Exusiai1 |
D |
July 27, 2023, 5 p.m. |
OK |
MS C++ 2017 |
TESTS |
52 |
124 |
3276800 |
|
|
215988398 |
RSL459 |
D |
July 27, 2023, 5:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
52 |
139 |
819200 |
|
|
215998239 |
PaulElPapito |
D |
July 27, 2023, 6:23 p.m. |
OK |
MS C++ 2017 |
TESTS |
52 |
139 |
6451200 |
|
|
216030638 |
2momo2 |
D |
July 28, 2023, 2:28 a.m. |
OK |
PyPy 3 |
TESTS |
52 |
155 |
16281600 |
|
|
215989025 |
grente |
D |
July 27, 2023, 5:13 p.m. |
OK |
PyPy 3 |
TESTS |
52 |
187 |
15052800 |
|
|
215984088 |
anshu271 |
D |
July 27, 2023, 4:46 p.m. |
OK |
PyPy 3 |
TESTS |
52 |
264 |
19763200 |
|
|
216031069 |
Mohamed_Hamed |
D |
July 28, 2023, 2:33 a.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
93 |
15769600 |
|
|
216028486 |
Vishnu_Actual |
D |
July 28, 2023, 2 a.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
108 |
22835200 |
|
|
215998905 |
siddharthraj |
D |
July 27, 2023, 6:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
109 |
19353600 |
|
|
215991876 |
Stortoise |
D |
July 27, 2023, 5:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
109 |
22835200 |
|
|
215990518 |
Kladrr |
D |
July 27, 2023, 5:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
109 |
22835200 |
|
|
215985630 |
DonC |
D |
July 27, 2023, 4:53 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
109 |
22835200 |
|
|
216021745 |
yupooh |
D |
July 28, 2023, 12:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
124 |
19046400 |
|
|
216030658 |
Mohamed_Hamed |
D |
July 28, 2023, 2:29 a.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
124 |
20480000 |
|
|
215999478 |
bergus |
D |
July 27, 2023, 6:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
124 |
22732800 |
|
|
216019618 |
vishnesh |
D |
July 27, 2023, 11:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
52 |
124 |
22835200 |
|
|
215986894 |
Asharma538 |
D |
July 27, 2023, 4:59 p.m. |
OK |
Python 3 |
TESTS |
52 |
93 |
5529600 |
|
|
216005662 |
reynaldocv |
D |
July 27, 2023, 7:40 p.m. |
OK |
Python 3 |
TESTS |
52 |
109 |
6144000 |
|
|
215988254 |
Faithnhope |
D |
July 27, 2023, 5:08 p.m. |
OK |
Python 3 |
TESTS |
52 |
140 |
9318400 |
|
|
216009495 |
Faithnhope |
D |
July 27, 2023, 8:26 p.m. |
OK |
Python 3 |
TESTS |
52 |
155 |
8089600 |
|
|
215984722 |
maikh07 |
D |
July 27, 2023, 4:49 p.m. |
OK |
Python 3 |
TESTS |
52 |
156 |
7372800 |
|
|
216004196 |
cohadar |
D |
July 27, 2023, 7:23 p.m. |
OK |
Python 3 |
TESTS |
52 |
171 |
5529600 |
|
|
215985314 |
chmo345 |
D |
July 27, 2023, 4:52 p.m. |
OK |
Rust 2021 |
TESTS |
52 |
15 |
2662400 |
|
|
216043008 |
Sarievo |
D |
July 28, 2023, 5:09 a.m. |
OK |
Rust 2021 |
TESTS |
52 |
46 |
8908800 |
|
|
remove filters
Back to search problems