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'Barbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw n numbers a_1, a_2, ldots, a_n without any mathematical symbols. The teacher explained to Barbara that she has to place the available symbols between the numbers in a way that would make the resulting expression 's value as large as possible. To find out which symbols were available the teacher has given Barbara a string s which contained that information. It 's easy to notice that Barbara has to place n - 1 symbols between numbers in total. The expression must start with a number and all symbols must be allowed (i.e. included in s ). Note that multiplication takes precedence over addition or subtraction, addition and subtraction have the same priority and performed from left to right. Help Barbara and create the required expression! The first line of the input contains a single integer n ( 1 <= n <= 10^5 ) -- the amount of numbers on the paper. The second line of the input contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 9 ), where a_i is the i -th element of a . The third line of the input contains the string s ( 1 <= |s| <= 3 ) -- symbols allowed in the expression. It is guaranteed that the string may only consist of symbols "-", "+" and "*". It is also guaranteed that all symbols in the string are distinct. Print n numbers separated by n - 1 symbols -- a mathematical expression with the greatest result. If there are multiple equally valid results -- output any one of them. The following answers also fit the first example: "2+2+0", "2+2-0", "2*2+0". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
100980255 |
Clovers |
F |
Dec. 12, 2020, 1:19 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
2048000 |
|
|
100985502 |
zzpc |
F |
Dec. 12, 2020, 4:27 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
2867200 |
|
|
100979407 |
LJC00118 |
F |
Dec. 12, 2020, 12:36 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
46 |
3276800 |
|
|
100988959 |
0x424E4453 |
F |
Dec. 12, 2020, 5:45 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
3993600 |
|
|
100980384 |
yijan |
F |
Dec. 12, 2020, 1:26 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
6144000 |
|
|
100984144 |
Grice |
F |
Dec. 12, 2020, 3:46 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
11059200 |
|
|
100984107 |
Grice |
F |
Dec. 12, 2020, 3:45 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
11059200 |
|
|
100984091 |
Grice |
F |
Dec. 12, 2020, 3:44 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
11059200 |
|
|
100984080 |
Grice |
F |
Dec. 12, 2020, 3:44 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
11059200 |
|
|
100984072 |
Grice |
F |
Dec. 12, 2020, 3:44 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
46 |
11059200 |
|
|
100983500 |
zhouzhendong |
F |
Dec. 12, 2020, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
90 |
46 |
1740800 |
|
|
100955641 |
dlalswp25 |
F |
Dec. 11, 2020, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
61 |
614400 |
|
|
100951392 |
heyshb |
F |
Dec. 11, 2020, 4:16 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
62 |
614400 |
|
|
100976183 |
pikmike |
F |
Dec. 11, 2020, 9:36 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
62 |
1331200 |
|
|
100984544 |
Fidisk |
F |
Dec. 12, 2020, 3:59 a.m. |
OK |
GNU C++14 |
TESTS |
90 |
62 |
4608000 |
|
|
100982543 |
SuperJ6 |
F |
Dec. 12, 2020, 2:57 a.m. |
OK |
GNU C++14 |
TESTS |
90 |
62 |
4812800 |
|
|
100979190 |
SuperJ6 |
F |
Dec. 12, 2020, 12:23 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
62 |
4812800 |
|
|
100979205 |
SuperJ6 |
F |
Dec. 12, 2020, 12:24 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
77 |
819200 |
|
|
100971704 |
BlueDiamond |
F |
Dec. 11, 2020, 7:43 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
93 |
3993600 |
|
|
100972180 |
sh1194 |
F |
Dec. 11, 2020, 7:52 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
109 |
512000 |
|
|
100979021 |
AlexFetisov |
F |
Dec. 12, 2020, 12:13 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
46 |
4403200 |
|
|
100947641 |
LayCurse |
F |
Dec. 11, 2020, 4:02 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
46 |
5017600 |
|
|
100981786 |
Rvess |
F |
Dec. 12, 2020, 2:29 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
61 |
921600 |
|
|
100974532 |
fjkdsahfklsah |
F |
Dec. 11, 2020, 8:44 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
61 |
921600 |
|
|
100988184 |
czhang2718 |
F |
Dec. 12, 2020, 5:31 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
61 |
1740800 |
|
|
100981112 |
200815147 |
F |
Dec. 12, 2020, 1:58 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
61 |
2457600 |
|
|
100957248 |
kriii |
F |
Dec. 11, 2020, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
512000 |
|
|
100967993 |
pikel_rik |
F |
Dec. 11, 2020, 6:39 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
614400 |
|
|
100981813 |
Rvess |
F |
Dec. 12, 2020, 2:30 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
62 |
921600 |
|
|
100981776 |
Rvess |
F |
Dec. 12, 2020, 2:29 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
62 |
921600 |
|
|
100978396 |
dorijanlendvaj |
F |
Dec. 11, 2020, 11:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
31 |
2355200 |
|
|
100966363 |
FlowerOfSorrow |
F |
Dec. 11, 2020, 6:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
409600 |
|
|
100979989 |
rama_pang |
F |
Dec. 12, 2020, 1:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1331200 |
|
|
100965653 |
natsugiri |
F |
Dec. 11, 2020, 6:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1331200 |
|
|
100959379 |
noimi |
F |
Dec. 11, 2020, 5:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1331200 |
|
|
100952446 |
Rubikun |
F |
Dec. 11, 2020, 4:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1536000 |
|
|
100960810 |
YouKn0wWho |
F |
Dec. 11, 2020, 5:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1638400 |
|
|
100953903 |
emthrm |
F |
Dec. 11, 2020, 4:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
1740800 |
|
|
100950222 |
ei133333 |
F |
Dec. 11, 2020, 4:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
2048000 |
|
|
100950665 |
jdurie |
F |
Dec. 11, 2020, 4:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
46 |
2662400 |
|
|
100964797 |
uwi |
F |
Dec. 11, 2020, 5:55 p.m. |
OK |
Java 11 |
TESTS |
89 |
202 |
0 |
|
|
100967766 |
uwi |
F |
Dec. 11, 2020, 6:35 p.m. |
OK |
Java 11 |
TESTS |
89 |
233 |
0 |
|
|
100986419 |
kclee2172 |
F |
Dec. 12, 2020, 4:51 a.m. |
OK |
PyPy 3 |
TESTS |
90 |
280 |
13312000 |
|
|
100980378 |
pwild |
F |
Dec. 12, 2020, 1:26 a.m. |
OK |
PyPy 3 |
TESTS |
90 |
889 |
13926400 |
|
|
remove filters
Back to search problems