Codeforces Round 954 (Div. 3)

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
1986 Codeforces Round 954 (Div. 3) FINISHED False 8100 18025763 June 23, 2024, 2:50 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15699 ) D Mathematical Problem PROGRAMMING brute force dp two pointers

B"You are given a string s of length n > 1 , consisting of digits from 0 to 9 . You must insert exactly n - 2 symbols + (addition) or x (multiplication) into this string to form a valid arithmetic expression. In this problem, the symbols cannot be placed before the first or after the last character of the string s , and two symbols cannot be written consecutively. Also, note that the order of the digits in the string cannot be changed. Let's consider s = 987009 : The result of the arithmetic expression is calculated according to the rules of mathematics -- first all multiplication operations are performed, then addition. You need to find the minimum result that can be obtained by inserting exactly n - 2 addition or multiplication symbols into the given string s . Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. Then follows their description. The first line of each test case contains a single integer n ( 2 <= q n <= q 20 ) -- the length of the string s . The second line of each test case contains a string s of length n , consisting of digits from 0 to 9 . For each test case, output the minimum result of the arithmetic expression that can be obtained by inserting exactly n - 2 addition or multiplication symbols into the given string. In the first four test cases, we cannot add symbols, so the answer will be the original number. In the fifth test case, the optimal answer looks as follows: 9 x 01 = 9 x 1 = 9 . In the sixth test case, the optimal answer looks as follows: 1 x 01 = 1 x 1 = 1 . In the seventh test case, the optimal answer looks as follows: 2 + 3 + 3 + 11 = 19 . In the eighth test case, one of the optimal answers looks as follows: 98 x 7 x 0 + 0 x 9 = 0 . "...

Tutorials

130762

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
267115043 chrisTris D June 24, 2024, 1:49 a.m. OK C# 10 TESTS 10 124 3481600
267104106 Dynamic17 D June 23, 2024, 9:44 p.m. OK C++14 (GCC 6-32) TESTS 10 46 0
267089915 keqing1907 D June 23, 2024, 6:31 p.m. OK C++14 (GCC 6-32) TESTS 5 46 0
267089882 LucaT123 D June 23, 2024, 6:30 p.m. OK C++14 (GCC 6-32) TESTS 5 46 0
267083799 huehuehue D June 23, 2024, 5:39 p.m. OK C++14 (GCC 6-32) TESTS 5 46 0
267083336 ayushk1234 D June 23, 2024, 5:35 p.m. OK C++14 (GCC 6-32) TESTS 5 46 0
267082770 leo_pu D June 23, 2024, 5:31 p.m. OK C++14 (GCC 6-32) TESTS 5 46 0
267092411 Rasoul006 D June 23, 2024, 6:59 p.m. OK C++14 (GCC 6-32) TESTS 5 46 7987200
267109245 lzh999 D June 23, 2024, 11:31 p.m. OK C++14 (GCC 6-32) TESTS 10 46 8089600
267086288 phuocson D June 23, 2024, 5:59 p.m. OK C++14 (GCC 6-32) TESTS 5 46 16076800
267131692 AyushPchavan D June 24, 2024, 5:42 a.m. OK C++14 (GCC 6-32) TESTS 10 61 0
267091636 krishna_kr.iitkgp D June 23, 2024, 6:50 p.m. OK C++17 (GCC 7-32) TESTS 5 31 0
267116675 kiki0756 D June 24, 2024, 2:20 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267131378 Sul_A. D June 24, 2024, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267131013 chaitanya_2408 D June 24, 2024, 5:35 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267124997 iAM_CODER_BHAI D June 24, 2024, 4:22 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267121440 shaswatk98 D June 24, 2024, 3:36 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267120154 teazation D June 24, 2024, 3:18 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267118743 cow23 D June 24, 2024, 2:55 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267117969 JahonaliX D June 24, 2024, 2:41 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267117849 mm1046 D June 24, 2024, 2:40 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
267098476 _As3ad D June 23, 2024, 8:14 p.m. OK C++20 (GCC 13-64) TESTS 5 31 0
267126806 infigeek D June 24, 2024, 4:43 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267133571 pj17 D June 24, 2024, 6:04 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267133181 hzzt D June 24, 2024, 5:59 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267132543 The-Oggy D June 24, 2024, 5:52 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267129620 kali1314 D June 24, 2024, 5:19 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267128179 computerscience D June 24, 2024, 5:01 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267127678 bonu_malitha D June 24, 2024, 4:54 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267126890 anshsaxena1703 D June 24, 2024, 4:44 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267123438 sanmai_reddy123 D June 24, 2024, 4:03 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
267123524 bluemegane D June 24, 2024, 4:04 a.m. OK C# 8 TESTS 10 125 2969600
267078396 escalatorup D June 23, 2024, 5:07 p.m. OK FPC TESTS 5 62 0
267115779 IEluan D June 24, 2024, 2:03 a.m. OK GNU C11 TESTS 10 77 307200
267076742 Dewanshu D June 23, 2024, 5:03 p.m. OK GNU C11 TESTS 5 92 0
267078466 msr1809 D June 23, 2024, 5:08 p.m. OK GNU C11 TESTS 5 92 409600
267081494 soumya_sakshi D June 23, 2024, 5:23 p.m. OK GNU C11 TESTS 5 93 0
267075365 lhz960904 D June 23, 2024, 5:01 p.m. OK Go TESTS 5 62 5120000
267083556 Bhuwan_36 D June 23, 2024, 5:37 p.m. OK Java 21 TESTS 5 233 409600
267083389 priyaroy3370 D June 23, 2024, 5:36 p.m. OK Java 21 TESTS 5 233 716800
267083911 Jagnath_Reddy D June 23, 2024, 5:40 p.m. OK Java 21 TESTS 5 233 819200
267129696 Pv2f4n D June 24, 2024, 5:20 a.m. OK Java 21 TESTS 10 234 921600
267086542 vikash_45 D June 23, 2024, 6:01 p.m. OK Java 21 TESTS 5 265 307200
267078093 grace.rd.xu D June 23, 2024, 5:04 p.m. OK Java 21 TESTS 5 265 614400
267095445 arnav_gupta D June 23, 2024, 7:35 p.m. OK Java 21 TESTS 5 280 512000
267092023 Sylvester_ D June 23, 2024, 6:54 p.m. OK Java 21 TESTS 5 281 716800
267076147 jai_bansal_007 D June 23, 2024, 5:02 p.m. OK Java 21 TESTS 5 281 2150400
267095095 aspgarv112 D June 23, 2024, 7:31 p.m. OK Java 21 TESTS 5 296 0
267083936 Artistic_code D June 23, 2024, 5:40 p.m. OK Java 8 TESTS 5 140 0
267078079 UnknownCoderty D June 23, 2024, 5:04 p.m. OK Java 8 TESTS 5 186 0
267122296 achyut88 D June 24, 2024, 3:48 a.m. OK Java 8 TESTS 10 203 0
267129513 om172 D June 24, 2024, 5:18 a.m. OK Java 8 TESTS 10 234 0
267076376 Un_Known_20 D June 23, 2024, 5:02 p.m. OK Java 8 TESTS 5 234 0
267076247 Klu_2100032420 D June 23, 2024, 5:02 p.m. OK Java 8 TESTS 5 264 0
267093633 Dhyanam2005 D June 23, 2024, 7:13 p.m. OK Java 8 TESTS 5 265 0
267077402 KoushikSarma D June 23, 2024, 5:04 p.m. OK Java 8 TESTS 5 281 0
267122294 samuelX159 D June 24, 2024, 3:48 a.m. OK Java 8 TESTS 10 296 0
267093810 Dhyanam2005 D June 23, 2024, 7:15 p.m. OK Java 8 TESTS 5 296 0
267077312 Karthik28 D June 23, 2024, 5:04 p.m. OK Kotlin 1.9 TESTS 5 218 0
267081256 Amman D June 23, 2024, 5:21 p.m. OK Kotlin 1.9 TESTS 5 327 0
267099507 wildbirb D June 23, 2024, 8:29 p.m. OK PyPy 3 TESTS 5 343 9011200
267097941 Qw04_Dragoknight D June 23, 2024, 8:07 p.m. OK PyPy 3 TESTS 5 358 9113600
267080952 dennis458 D June 23, 2024, 5:20 p.m. OK PyPy 3 TESTS 5 389 9216000
267082605 white_two D June 23, 2024, 5:30 p.m. OK PyPy 3 TESTS 5 389 10035200
267075795 rahul_a22 D June 23, 2024, 5:02 p.m. OK PyPy 3 TESTS 5 436 9625600
267078908 ZzaZi D June 23, 2024, 5:09 p.m. OK PyPy 3 TESTS 5 452 9318400
267080889 pedastrian57 D June 23, 2024, 5:19 p.m. OK PyPy 3 TESTS 5 514 72396800
267111047 KingofCSES D June 24, 2024, 12:17 a.m. OK PyPy 3 TESTS 10 624 9625600
267088553 del1990ta D June 23, 2024, 6:19 p.m. OK PyPy 3 TESTS 5 639 9420800
267084153 SinghAditya D June 23, 2024, 5:41 p.m. OK PyPy 3 TESTS 5 687 9625600
267089975 VidGa D June 23, 2024, 6:32 p.m. OK PyPy 3-64 TESTS 5 139 5324800
267092714 DeadMan69 D June 23, 2024, 7:02 p.m. OK PyPy 3-64 TESTS 5 140 6348800
267078863 me_333 D June 23, 2024, 5:09 p.m. OK PyPy 3-64 TESTS 5 155 5632000
267108776 NitroSpear D June 23, 2024, 11:20 p.m. OK PyPy 3-64 TESTS 10 155 6348800
267083216 singh.eureka D June 23, 2024, 5:35 p.m. OK PyPy 3-64 TESTS 5 171 6656000
267118440 231414 D June 24, 2024, 2:50 a.m. OK PyPy 3-64 TESTS 10 171 7065600
267082032 RobinFromTheHood D June 23, 2024, 5:26 p.m. OK PyPy 3-64 TESTS 5 171 7065600
267084594 kibr D June 23, 2024, 5:46 p.m. OK PyPy 3-64 TESTS 5 171 7372800
267133165 _Ryu__ D June 24, 2024, 5:59 a.m. OK PyPy 3-64 TESTS 10 171 8601600
267087045 takijkstra D June 23, 2024, 6:05 p.m. OK PyPy 3-64 TESTS 5 186 7782400
267096972 shrek27 D June 23, 2024, 7:55 p.m. OK Python 3 TESTS 5 140 2662400
267078778 helcpy.. D June 23, 2024, 5:09 p.m. OK Python 3 TESTS 5 171 0
267075436 siddharththecoder D June 23, 2024, 5:01 p.m. OK Python 3 TESTS 5 186 0
267088912 aknov D June 23, 2024, 6:22 p.m. OK Python 3 TESTS 5 202 0
267099545 deepaksaiM D June 23, 2024, 8:30 p.m. OK Python 3 TESTS 5 265 0
267076109 Mr_Surfer D June 23, 2024, 5:02 p.m. OK Python 3 TESTS 5 280 0
267081675 ryanbear1434 D June 23, 2024, 5:24 p.m. OK Python 3 TESTS 5 281 0
267090753 nkp30 D June 23, 2024, 6:39 p.m. OK Python 3 TESTS 5 296 0
267086526 karatel_rai D June 23, 2024, 6:01 p.m. OK Python 3 TESTS 5 296 0
267128184 eugalt D June 24, 2024, 5:01 a.m. OK Python 3 TESTS 10 343 1331200
267091313 TimeTraveler D June 23, 2024, 6:46 p.m. OK Ruby 3 TESTS 5 405 1536000
267076191 ag_pulkit D June 23, 2024, 5:02 p.m. OK Ruby 3 TESTS 5 499 409600
267106894 0x81 D June 23, 2024, 10:38 p.m. OK Ruby 3 TESTS 10 593 1433600
267106808 0x81 D June 23, 2024, 10:36 p.m. OK Ruby 3 TESTS 10 1296 1536000
267106705 0x81 D June 23, 2024, 10:34 p.m. OK Ruby 3 TESTS 10 1296 1536000
267106306 0x81 D June 23, 2024, 10:26 p.m. OK Ruby 3 TESTS 10 1750 1638400
267080866 abdessamad.anssem D June 23, 2024, 5:19 p.m. OK Rust 2021 TESTS 5 61 0

remove filters

Back to search problems