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 have a string s -- a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands: Let Grid(s) be the grid of minimum possible area such that there is a position in the grid where you can place the robot in such a way that it will not fall from the grid while running the sequence of commands s . For example, if s = text{DSAWWAW} then Grid(s) is the 4 x 3 grid: You have 4 extra letters: one 'W', one 'A', one 'S', one 'D'. You'd like to insert at most one of these letters in any position of sequence s to minimize the area of Grid(s) . What is the minimum area of Grid(s) you can achieve? The first line contains one integer T ( 1 <= T <= 1000 ) -- the number of queries. Next T lines contain queries: one per line. This line contains single string s ( 1 <= |s| <= 2 cdot 10^5 , s_i in { text{W}, text{A}, text{S}, text{D} } ) -- the sequence of commands. It's guaranteed that the total length of s over all queries doesn't exceed 2 cdot 10^5 . Print T integers: one per query. For each query print the minimum area of Grid(s) you can achieve. In the first query you have to get string text{DSAWW} underline{D} text{AW} . In second and third queries you can not decrease the area of Grid(s) . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
58447337 |
__Salty__ |
C |
Aug. 7, 2019, 3:41 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
819200 |
|
2100 |
58453642 |
SeventeenYears |
C |
Aug. 7, 2019, 4:17 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
1843200 |
|
2100 |
58443332 |
LittleBeetle |
C |
Aug. 7, 2019, 3:18 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
9625600 |
|
2100 |
58456068 |
XHRlyb_2001 |
C |
Aug. 7, 2019, 4:29 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
9830400 |
|
2100 |
58456917 |
jxf378440404 |
C |
Aug. 7, 2019, 4:33 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
0 |
|
2100 |
58452778 |
alocytus |
C |
Aug. 7, 2019, 4:12 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
0 |
|
2100 |
58455260 |
llyc |
C |
Aug. 7, 2019, 4:26 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
204800 |
|
2100 |
58454410 |
Fuzen527 |
C |
Aug. 7, 2019, 4:21 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
204800 |
|
2100 |
58451506 |
Torta |
C |
Aug. 7, 2019, 4:05 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
204800 |
|
2100 |
58450935 |
__stdcall |
C |
Aug. 7, 2019, 4:02 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
31 |
204800 |
|
2100 |
58453326 |
ovis96 |
C |
Aug. 7, 2019, 4:15 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
307200 |
|
2100 |
58456497 |
jell |
C |
Aug. 7, 2019, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
512000 |
|
2100 |
58453663 |
sardhara_preet |
C |
Aug. 7, 2019, 4:17 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
512000 |
|
2100 |
58450740 |
Devil |
C |
Aug. 7, 2019, 4:01 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
2764800 |
|
2100 |
58442755 |
icecuber |
C |
Aug. 7, 2019, 3:14 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
5324800 |
|
2100 |
58454341 |
PhantasmDragon |
C |
Aug. 7, 2019, 4:21 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
15 |
10035200 |
|
2100 |
58453881 |
Robsob |
C |
Aug. 7, 2019, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
204800 |
|
2100 |
58452041 |
rdd6584 |
C |
Aug. 7, 2019, 4:08 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
204800 |
|
2100 |
58451402 |
TheGrayCode |
C |
Aug. 7, 2019, 4:05 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
512000 |
|
2100 |
58451000 |
rfpermen |
C |
Aug. 7, 2019, 4:02 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
512000 |
|
2100 |
58446475 |
i.e |
C |
Aug. 7, 2019, 3:36 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
3686400 |
|
2100 |
58449202 |
nyaa |
C |
Aug. 7, 2019, 3:52 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
5324800 |
|
2100 |
58454749 |
FlowerOfSorrow |
C |
Aug. 7, 2019, 4:23 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
512000 |
|
2100 |
58448417 |
INVWVZ |
C |
Aug. 7, 2019, 3:48 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
512000 |
|
2100 |
58452256 |
LordVoIdebug |
C |
Aug. 7, 2019, 4:10 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
1331200 |
|
2100 |
58454969 |
stupid_username |
C |
Aug. 7, 2019, 4:24 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
1536000 |
|
2100 |
58446132 |
ashmelev |
C |
Aug. 7, 2019, 3:35 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
2560000 |
|
2100 |
58456761 |
despair |
C |
Aug. 7, 2019, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
3891200 |
|
2100 |
58443923 |
fdironia |
C |
Aug. 7, 2019, 3:21 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
8499200 |
|
2100 |
58455141 |
Tourist_Sa_Dec |
C |
Aug. 7, 2019, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
30 |
8601600 |
|
2100 |
58455907 |
StayAwayFromBitches |
C |
Aug. 7, 2019, 4:29 p.m. |
OK |
Java 8 |
TESTS |
17 |
124 |
0 |
|
2100 |
58447561 |
AkshajK |
C |
Aug. 7, 2019, 3:43 p.m. |
OK |
Java 8 |
TESTS |
17 |
124 |
0 |
|
2100 |
58455472 |
fpeterfalvi |
C |
Aug. 7, 2019, 4:27 p.m. |
OK |
Java 8 |
TESTS |
17 |
139 |
7270400 |
|
2100 |
58452475 |
_mina |
C |
Aug. 7, 2019, 4:11 p.m. |
OK |
Java 8 |
TESTS |
17 |
140 |
0 |
|
2100 |
58445180 |
dalt |
C |
Aug. 7, 2019, 3:29 p.m. |
OK |
Java 8 |
TESTS |
17 |
155 |
0 |
|
2100 |
58456159 |
lpm |
C |
Aug. 7, 2019, 4:30 p.m. |
OK |
Java 8 |
TESTS |
17 |
171 |
0 |
|
2100 |
58449299 |
Tlatoani |
C |
Aug. 7, 2019, 3:53 p.m. |
OK |
Java 8 |
TESTS |
17 |
171 |
0 |
|
2100 |
58450421 |
Musin |
C |
Aug. 7, 2019, 3:59 p.m. |
OK |
Java 8 |
TESTS |
17 |
186 |
15769600 |
|
2100 |
58450471 |
keymoon |
C |
Aug. 7, 2019, 3:59 p.m. |
OK |
Mono C# |
TESTS |
17 |
77 |
7065600 |
|
2100 |
58451840 |
tarattata1 |
C |
Aug. 7, 2019, 4:07 p.m. |
OK |
MS C++ |
TESTS |
17 |
31 |
8192000 |
|
2100 |
58447431 |
nvnulstu |
C |
Aug. 7, 2019, 3:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
46 |
1331200 |
|
2100 |
58456116 |
15872954516 |
C |
Aug. 7, 2019, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
46 |
3891200 |
|
2100 |
58453336 |
zzq233 |
C |
Aug. 7, 2019, 4:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
46 |
5017600 |
|
2100 |
58449400 |
siwei |
C |
Aug. 7, 2019, 3:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
46 |
5427200 |
|
2100 |
58453397 |
prvocislo |
C |
Aug. 7, 2019, 4:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
62 |
819200 |
|
2100 |
58450994 |
alexwice |
C |
Aug. 7, 2019, 4:02 p.m. |
OK |
PyPy 2 |
TESTS |
17 |
483 |
22016000 |
|
2100 |
58450995 |
marpetr |
C |
Aug. 7, 2019, 4:02 p.m. |
OK |
PyPy 2 |
TESTS |
17 |
733 |
93696000 |
|
2100 |
58453932 |
titia |
C |
Aug. 7, 2019, 4:19 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
202 |
7065600 |
|
2100 |
58454938 |
PhilTheFish |
C |
Aug. 7, 2019, 4:24 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
280 |
8499200 |
|
2100 |
58456490 |
anagohirame |
C |
Aug. 7, 2019, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
358 |
17715200 |
|
2100 |
58448502 |
nega_op |
C |
Aug. 7, 2019, 3:48 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
436 |
9830400 |
|
2100 |
remove filters
Back to search problems