Hello 2022

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1621 Hello 2022 FINISHED False 8100 135185123 Jan. 3, 2022, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 635 ) F Strange Instructions PROGRAMMING greedy

Dasha has (10^{100}) coins. Recently, she found a binary string (s) of length (n) and some operations that allows to change this string (she can do each operation any number of times): Replace substring 00 of (s) by 0 and receive (a) coins. Replace substring 11 of (s) by 1 and receive (b) coins. Remove 0 from any position in (s) and pay (c) coins. It turned out that while doing this operations Dasha should follow the rule: It is forbidden to do two operations with the same parity in a row. Operations are numbered by integers (1)-(3) in the order they are given above. Please, calculate what is the maximum profit Dasha can get by doing these operations and following this rule. The first line contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains four integers (n), (a), (b), (c) ((1 \leq n \leq 10^5, 1 \leq a, b, c \leq 10^9)). The second line of each test case contains a binary string (s) of length (n). It is guaranteed that the total sum of (n) over all test cases doesn't exceed (2 \cdot 10^5). For each test case print the answer. In the first test case one of the optimal sequences of operations is 0 11 01 (\rightarrow) 01 0 1 (\rightarrow) 0 11 (\rightarrow) 01 . This sequence of operations consists of operations (2), (3) and (2) in this order. It satisfies all rules and gives profit (3). It can be shown that it is impossible to achieve higher profit in this test case, so the answer is (3). In the second test case one of the optimal sequences of operations is 110 00 1 (\rightarrow) 11 001 (\rightarrow) 1 00 1 (\rightarrow) 101 . In the third test case one of the optimal sequences of operations is 01 11 10 (\rightarrow) 0 1110 (\rightarrow) 11 10 (\rightarrow) 11 0 (\rightarrow) 11 (\rightarrow) 1 .

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
141563925 GoGooLi F Jan. 3, 2022, 4:41 p.m. OK GNU C++14 TESTS 37 31 819200
141562071 Hazyknight F Jan. 3, 2022, 4:37 p.m. OK GNU C++14 TESTS 37 31 1024000
141566128 awoo F Jan. 3, 2022, 4:46 p.m. OK GNU C++14 TESTS 37 31 1536000
141602442 ugly2333 F Jan. 4, 2022, 4:56 a.m. OK GNU C++14 TESTS 37 31 2048000
141598551 fengzhengwei F Jan. 4, 2022, 3:40 a.m. OK GNU C++14 TESTS 37 46 2252800
141565524 fengzhengwei F Jan. 3, 2022, 4:45 p.m. OK GNU C++14 TESTS 37 46 2252800
141598183 Shameimaru_Aya F Jan. 4, 2022, 3:32 a.m. OK GNU C++14 TESTS 37 46 6963200
141596177 newbiewzs F Jan. 4, 2022, 2:38 a.m. OK GNU C++14 TESTS 37 46 38707200
141566345 s_r_f F Jan. 3, 2022, 4:46 p.m. OK GNU C++14 TESTS 37 93 1740800
141591935 happyguy656 F Jan. 3, 2022, 11:56 p.m. OK GNU C++14 TESTS 37 108 2969600
141565456 bacon_cwk F Jan. 3, 2022, 4:44 p.m. OK GNU C++17 TESTS 37 15 614400
141587312 anpoli99 F Jan. 3, 2022, 8:59 p.m. OK GNU C++17 TESTS 37 31 512000
141570686 HuaJun F Jan. 3, 2022, 5:24 p.m. OK GNU C++17 TESTS 37 31 819200
141566584 wifiii F Jan. 3, 2022, 4:46 p.m. OK GNU C++17 TESTS 37 31 921600
141573884 Barichek F Jan. 3, 2022, 5:44 p.m. OK GNU C++17 TESTS 37 31 1126400
141562387 cerberus97 F Jan. 3, 2022, 4:38 p.m. OK GNU C++17 TESTS 37 31 2764800
141561558 yp155136 F Jan. 3, 2022, 4:36 p.m. OK GNU C++17 TESTS 37 31 5017600
141572624 IgorI F Jan. 3, 2022, 5:34 p.m. OK GNU C++17 TESTS 37 46 614400
141566546 gabrielwu F Jan. 3, 2022, 4:46 p.m. OK GNU C++17 TESTS 37 46 716800
141598104 HideOneMan2002 F Jan. 4, 2022, 3:30 a.m. OK GNU C++17 TESTS 37 46 921600
141584160 ksun48 F Jan. 3, 2022, 7:50 p.m. OK GNU C++17 (64) TESTS 37 30 716800
141594801 huansir F Jan. 4, 2022, 1:57 a.m. OK GNU C++17 (64) TESTS 37 31 512000
141594794 q-w-q-w-q F Jan. 4, 2022, 1:57 a.m. OK GNU C++17 (64) TESTS 37 31 512000
141591520 Laurie F Jan. 3, 2022, 11:36 p.m. OK GNU C++17 (64) TESTS 37 31 614400
141602741 Geothermal F Jan. 4, 2022, 5 a.m. OK GNU C++17 (64) TESTS 37 31 716800
141574498 lumibons F Jan. 3, 2022, 5:48 p.m. OK GNU C++17 (64) TESTS 37 31 921600
141562735 basic_string F Jan. 3, 2022, 4:39 p.m. OK GNU C++17 (64) TESTS 37 31 1024000
141582599 Gapzinho F Jan. 3, 2022, 7:25 p.m. OK GNU C++17 (64) TESTS 37 31 1843200
141570739 Froggay F Jan. 3, 2022, 5:24 p.m. OK GNU C++17 (64) TESTS 37 31 2150400
141564306 balbit F Jan. 3, 2022, 4:42 p.m. OK GNU C++17 (64) TESTS 37 31 2252800
141578700 flashmt F Jan. 3, 2022, 6:32 p.m. OK GNU C++20 (64) TESTS 37 30 614400
141563649 sevlll F Jan. 3, 2022, 4:41 p.m. OK GNU C++20 (64) TESTS 37 30 1740800
141567025 maximumSHOT F Jan. 3, 2022, 4:47 p.m. OK GNU C++20 (64) TESTS 37 31 512000
141596255 gxy001 F Jan. 4, 2022, 2:40 a.m. OK GNU C++20 (64) TESTS 37 31 614400
141579382 flashmt F Jan. 3, 2022, 6:41 p.m. OK GNU C++20 (64) TESTS 37 31 614400
141564848 gxy001 F Jan. 3, 2022, 4:43 p.m. OK GNU C++20 (64) TESTS 37 31 614400
141573590 risujiroh F Jan. 3, 2022, 5:41 p.m. OK GNU C++20 (64) TESTS 37 31 716800
141562318 rama_pang F Jan. 3, 2022, 4:38 p.m. OK GNU C++20 (64) TESTS 37 31 819200
141568412 jiangly F Jan. 3, 2022, 4:49 p.m. OK GNU C++20 (64) TESTS 37 31 921600
141592558 chctxdy68 F Jan. 4, 2022, 12:27 a.m. OK GNU C++20 (64) TESTS 37 31 1228800
141587944 LongWalk F Jan. 3, 2022, 9:18 p.m. OK Java 11 TESTS 37 218 0
141573827 whatshisbucket F Jan. 3, 2022, 5:43 p.m. OK PyPy 3 TESTS 37 764 10752000
141586045 conqueror_of_tourist F Jan. 3, 2022, 8:28 p.m. OK PyPy 3-64 TESTS 37 420 13516800
141563546 sansen F Jan. 3, 2022, 4:41 p.m. OK Rust 2021 TESTS 37 31 3072000

remove filters

Back to search problems