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'No, not "random" numbers. Ranom digits are denoted by uppercase Latin letters from A to E. Moreover, the value of the letter A is 1 , B is 10 , C is 100 , D is 1000 , E is 10000 . A Ranom number is a sequence of Ranom digits. The value of the Ranom number is calculated as follows: the values of all digits are summed up, but some digits are taken with negative signs: a digit is taken with negative sign if there is a digit with a strictly greater value to the right of it (not necessarily immediately after it); otherwise, that digit is taken with a positive sign. For example, the value of the Ranom number DAAABDCA is 1000 - 1 - 1 - 1 - 10 + 1000 + 100 + 1 = 2088 . You are given a Ranom number. You can change no more than one digit in it. Calculate the maximum possible value of the resulting number. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The only line of each test case contains a string s ( 1 <= |s| <= 2 cdot 10^5 ) consisting of uppercase Latin letters from A to E -- the Ranom number you are given. The sum of the string lengths over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single integer -- the maximum possible value of the number, if you can change no more than one digit in it. In the first example, you can get EAAABDCA with the value 10000-1-1-1-10+1000+100+1=11088 . In the second example, you can get EB with the value 10000+10=10010 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
209519984 |
bluemegane |
C |
June 13, 2023, 5:26 a.m. |
OK |
C# 8 |
TESTS |
48 |
140 |
6758400 |
|
|
209518389 |
2847940240 |
C |
June 13, 2023, 4:58 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
48 |
1996 |
29388800 |
|
|
209493041 |
its_rockstar |
C |
June 12, 2023, 7:43 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
30 |
1331200 |
|
|
209515355 |
ajaman190 |
C |
June 13, 2023, 4:02 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
512000 |
|
|
209514622 |
peter112358 |
C |
June 13, 2023, 3:50 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
1024000 |
|
|
209475211 |
Coryc1e |
C |
June 12, 2023, 4:50 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
1024000 |
|
|
209473409 |
lishujia090623 |
C |
June 12, 2023, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
1024000 |
|
|
209516346 |
dimitri1244 |
C |
June 13, 2023, 4:19 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
3686400 |
|
|
209514702 |
feiyuH |
C |
June 13, 2023, 3:52 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
3788800 |
|
|
209476145 |
astilate |
C |
June 12, 2023, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
5017600 |
|
|
209506073 |
Adp_D |
C |
June 13, 2023, 1:12 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
31 |
6041600 |
|
|
209519776 |
xpact_chaos |
C |
June 13, 2023, 5:23 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
46 |
512000 |
|
|
209495340 |
anasuss |
C |
June 12, 2023, 8:18 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
30 |
512000 |
|
|
209517569 |
IskhakKutBilim |
C |
June 13, 2023, 4:41 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
30 |
8192000 |
|
|
209516446 |
PirateHunter_ZORO |
C |
June 13, 2023, 4:21 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209495414 |
anasuss |
C |
June 12, 2023, 8:19 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209491799 |
ilia13122008 |
C |
June 12, 2023, 7:25 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209486048 |
figuring-out |
C |
June 12, 2023, 6:20 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209479751 |
sigma-yyf |
C |
June 12, 2023, 5:20 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209471957 |
vit_72 |
C |
June 12, 2023, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
512000 |
|
|
209515277 |
ITIS_DuyAnh |
C |
June 13, 2023, 4:01 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
1331200 |
|
|
209517101 |
Coder_Nayak |
C |
June 13, 2023, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
2150400 |
|
|
209519783 |
TypeYippie |
C |
June 13, 2023, 5:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
15 |
716800 |
|
|
209503130 |
Alex_Wei |
C |
June 12, 2023, 11:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
30 |
2867200 |
|
|
209511940 |
Once_I_Liked_AGirl |
C |
June 13, 2023, 3:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
512000 |
|
|
209483891 |
monkey8 |
C |
June 12, 2023, 5:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
512000 |
|
|
209476717 |
MESSIvsCR7 |
C |
June 12, 2023, 4:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
1024000 |
|
|
209483764 |
eriktse |
C |
June 12, 2023, 5:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
1843200 |
|
|
209513425 |
Alex_Wei |
C |
June 13, 2023, 3:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
2048000 |
|
|
209513384 |
Alex_Wei |
C |
June 13, 2023, 3:29 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
2048000 |
|
|
209510635 |
RinkaSnow |
C |
June 13, 2023, 2:39 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
3993600 |
|
|
209520094 |
Chifwin |
C |
June 13, 2023, 5:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
8601600 |
|
|
209500510 |
pacha2880 |
C |
June 12, 2023, 10:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
512000 |
|
|
209512482 |
Palmerin |
C |
June 13, 2023, 3:12 a.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
2150400 |
|
|
209481337 |
dingzhen_ |
C |
June 12, 2023, 5:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
2355200 |
|
|
209472224 |
mawerty |
C |
June 12, 2023, 4:36 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
2355200 |
|
|
209474769 |
vgtcross |
C |
June 12, 2023, 4:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
2969600 |
|
|
209483195 |
KM_Parvez |
C |
June 12, 2023, 5:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
3174400 |
|
|
209476216 |
Osmabnlden |
C |
June 12, 2023, 4:55 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
5529600 |
|
|
209507124 |
Marckess |
C |
June 13, 2023, 1:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
10137600 |
|
|
209474443 |
borgar02 |
C |
June 12, 2023, 4:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
15257600 |
|
|
209512657 |
Zero_L |
C |
June 13, 2023, 3:16 a.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
15 |
80691200 |
|
|
209477600 |
liangjiahui11 |
C |
June 12, 2023, 5:04 p.m. |
OK |
Go |
TESTS |
48 |
77 |
17100800 |
|
|
209481474 |
WhatAGod |
C |
June 12, 2023, 5:36 p.m. |
OK |
Java 11 |
TESTS |
48 |
312 |
0 |
|
|
209476227 |
Mibashara |
C |
June 12, 2023, 4:55 p.m. |
OK |
Java 11 |
TESTS |
48 |
420 |
80384000 |
|
|
209471190 |
adi854105 |
C |
June 12, 2023, 4:33 p.m. |
OK |
Java 11 |
TESTS |
48 |
436 |
0 |
|
|
209491119 |
Abhinav__hadole |
C |
June 12, 2023, 7:16 p.m. |
OK |
Java 11 |
TESTS |
48 |
1138 |
0 |
|
|
209477806 |
butteronpoptart |
C |
June 12, 2023, 5:05 p.m. |
OK |
Java 11 |
TESTS |
48 |
1247 |
92467200 |
|
|
209472536 |
Yousef_Badr |
C |
June 12, 2023, 4:36 p.m. |
OK |
Java 17 |
TESTS |
48 |
217 |
614400 |
|
|
209513114 |
daksh_02 |
C |
June 13, 2023, 3:24 a.m. |
OK |
Java 17 |
TESTS |
48 |
483 |
102297600 |
|
|
209471616 |
redhair_rs |
C |
June 12, 2023, 4:34 p.m. |
OK |
Java 17 |
TESTS |
48 |
1045 |
7475200 |
|
|
209511647 |
xiaoshua |
C |
June 13, 2023, 2:57 a.m. |
OK |
Java 8 |
TESTS |
48 |
139 |
0 |
|
|
209493285 |
Ashu2030 |
C |
June 12, 2023, 7:46 p.m. |
OK |
Java 8 |
TESTS |
48 |
171 |
0 |
|
|
209475335 |
RMA-NB |
C |
June 12, 2023, 4:50 p.m. |
OK |
Java 8 |
TESTS |
48 |
202 |
0 |
|
|
209483958 |
Ahmad_Hoseiny |
C |
June 12, 2023, 5:59 p.m. |
OK |
Java 8 |
TESTS |
48 |
233 |
12185600 |
|
|
209485134 |
NerfThis |
C |
June 12, 2023, 6:10 p.m. |
OK |
Java 8 |
TESTS |
48 |
265 |
14848000 |
|
|
209494698 |
Gaurav3478 |
C |
June 12, 2023, 8:07 p.m. |
OK |
Java 8 |
TESTS |
48 |
296 |
77824000 |
|
|
209475140 |
DeadPixel99 |
C |
June 12, 2023, 4:49 p.m. |
OK |
Java 8 |
TESTS |
48 |
296 |
77824000 |
|
|
209483572 |
The_terminator |
C |
June 12, 2023, 5:55 p.m. |
OK |
Java 8 |
TESTS |
48 |
405 |
0 |
|
|
209480354 |
Mohamed_Ahmed |
C |
June 12, 2023, 5:26 p.m. |
OK |
Java 8 |
TESTS |
48 |
452 |
73625600 |
|
|
209516511 |
I_Need_Alex_R_Coleman |
C |
June 13, 2023, 4:22 a.m. |
OK |
Java 8 |
TESTS |
48 |
561 |
103936000 |
|
|
209520183 |
Exusiai1 |
C |
June 13, 2023, 5:28 a.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
9420800 |
|
|
209478493 |
maxK99 |
C |
June 12, 2023, 5:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
46 |
819200 |
|
|
209470686 |
abhijitha10 |
C |
June 12, 2023, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
170 |
2457600 |
|
|
209470260 |
rahul0310 |
C |
June 12, 2023, 4:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
170 |
2457600 |
|
|
209478453 |
iN_siDious |
C |
June 12, 2023, 5:10 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
889 |
22528000 |
|
|
209474360 |
quandum |
C |
June 12, 2023, 4:45 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
1153 |
158208000 |
|
|
209485091 |
hvbird |
C |
June 12, 2023, 6:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
280 |
11776000 |
|
|
209493649 |
damya |
C |
June 12, 2023, 7:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
311 |
22118400 |
|
|
209521363 |
Dhaval_kumar |
C |
June 13, 2023, 5:45 a.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
312 |
9625600 |
|
|
209504023 |
Harry_yash |
C |
June 13, 2023, 12:08 a.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
374 |
10752000 |
|
|
209497627 |
rmr |
C |
June 12, 2023, 9 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
374 |
14131200 |
|
|
209490422 |
SoleProprietor |
C |
June 12, 2023, 7:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
374 |
38195200 |
|
|
209507113 |
mkawa2 |
C |
June 13, 2023, 1:38 a.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
389 |
9830400 |
|
|
209499953 |
MassimoG |
C |
June 12, 2023, 9:53 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
420 |
10137600 |
|
|
209516408 |
yingkui |
C |
June 13, 2023, 4:20 a.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
436 |
9830400 |
|
|
209473628 |
ZrjaK |
C |
June 12, 2023, 4:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
48 |
436 |
11571200 |
|
|
209471095 |
Navneetkrh |
C |
June 12, 2023, 4:33 p.m. |
OK |
Python 3 |
TESTS |
48 |
1153 |
3379200 |
|
|
209520810 |
klu2100031997 |
C |
June 13, 2023, 5:37 a.m. |
OK |
Python 3 |
TESTS |
48 |
1200 |
3379200 |
|
|
209511763 |
bridgekiller |
C |
June 13, 2023, 3 a.m. |
OK |
Python 3 |
TESTS |
48 |
1793 |
12902400 |
|
|
209509342 |
YummyPie |
C |
June 13, 2023, 2:19 a.m. |
OK |
Rust 2021 |
TESTS |
48 |
31 |
2355200 |
|
|
209513117 |
YummyPie |
C |
June 13, 2023, 3:24 a.m. |
OK |
Rust 2021 |
TESTS |
48 |
46 |
4710400 |
|
|
209492039 |
kost |
C |
June 12, 2023, 7:28 p.m. |
OK |
Rust 2021 |
TESTS |
48 |
62 |
18534400 |
|
|
209481507 |
0npata |
C |
June 12, 2023, 5:36 p.m. |
OK |
Rust 2021 |
TESTS |
48 |
93 |
2969600 |
|
|
209483080 |
haihamabossu |
C |
June 12, 2023, 5:51 p.m. |
OK |
Rust 2021 |
TESTS |
48 |
358 |
14028800 |
|
|
209478816 |
YummyPie |
C |
June 12, 2023, 5:12 p.m. |
OK |
Rust 2021 |
TESTS |
48 |
467 |
53657600 |
|
|
remove filters
Back to search problems