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"There is a one-dimensional grid of length n . The i -th cell of the grid contains a character s_i , which is either '<' or '>'. When a pinball is placed on one of the cells, it moves according to the following rules: You need to answer n independent queries. In the i -th query, a pinball will be placed on the i -th cell. Note that we always place a pinball on the initial grid. For each query, calculate how many seconds it takes the pinball to leave the grid. It can be shown that the pinball will always leave the grid within a finite number of steps. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 5 cdot 10^5 ). The second line of each test case contains a string s_1s_2 ldots s_{n} of length n consisting of characters '<' and '>'. It is guaranteed that the sum of n over all test cases does not exceed 5 cdot 10^5 . For each test case, for each i ( 1 <= i <= n ) output the answer if a pinball is initially placed on the i -th cell. In the first test case, the movement of the pinball for i=1 is shown in the following pictures. It takes the pinball 3 seconds to leave the grid. The movement of the pinball for i=2 is shown in the following pictures. It takes the pinball 6 seconds to leave the grid. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
248947980 |
Gassa |
B |
Feb. 29, 2024, 3:48 p.m. |
OK |
D |
TESTS |
19 |
421 |
37888000 |
|
|
248999885 |
Gassa |
B |
Feb. 29, 2024, 9:23 p.m. |
OK |
D |
TESTS |
19 |
529 |
58060800 |
|
|
249000335 |
Sparkle_Twilight |
B |
Feb. 29, 2024, 9:30 p.m. |
OK |
D |
TESTS |
19 |
561 |
58060800 |
|
|
249011492 |
RabbieWjy |
B |
March 1, 2024, 1:16 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
140 |
2560000 |
|
|
248924367 |
fengqiyuka |
B |
Feb. 29, 2024, 3:06 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
170 |
8499200 |
|
|
249032664 |
Rhyme3 |
B |
March 1, 2024, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
171 |
1024000 |
|
|
248933416 |
Muelsyse |
B |
Feb. 29, 2024, 3:21 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
171 |
4505600 |
|
|
248941340 |
kes0716 |
B |
Feb. 29, 2024, 3:36 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
186 |
8499200 |
|
|
248924090 |
cfhj |
B |
Feb. 29, 2024, 3:05 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
186 |
11980800 |
|
|
248922880 |
chen_zexing |
B |
Feb. 29, 2024, 3:03 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
186 |
12492800 |
|
|
248923703 |
Flamire |
B |
Feb. 29, 2024, 3:05 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
187 |
12492800 |
|
|
248957996 |
pentiment |
B |
Feb. 29, 2024, 4:07 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
187 |
16588800 |
|
|
248928005 |
fire_water |
B |
Feb. 29, 2024, 3:12 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
187 |
16588800 |
|
|
248959001 |
ImmortaLimit |
B |
Feb. 29, 2024, 4:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
92 |
49356800 |
|
|
249014959 |
JWRuixi |
B |
March 1, 2024, 2:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
8499200 |
|
|
249014277 |
lethan3 |
B |
March 1, 2024, 2:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
8908800 |
|
|
248933532 |
t98slider |
B |
Feb. 29, 2024, 3:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
124 |
10342400 |
|
|
249009893 |
zlxFTH |
B |
March 1, 2024, 12:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
139 |
7168000 |
|
|
248956566 |
Lol2004 |
B |
Feb. 29, 2024, 4:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
139 |
9830400 |
|
|
248992817 |
qxforever |
B |
Feb. 29, 2024, 7:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
139 |
13619200 |
|
|
249010443 |
Irmuun.Ch |
B |
March 1, 2024, 12:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
139 |
21606400 |
|
|
249009939 |
zlxFTH |
B |
March 1, 2024, 12:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
140 |
7168000 |
|
|
248933559 |
zlxFTH |
B |
Feb. 29, 2024, 3:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
140 |
7168000 |
|
|
248986197 |
Kusmir |
B |
Feb. 29, 2024, 7:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
1024000 |
|
|
248953686 |
adepteXiao |
B |
Feb. 29, 2024, 3:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
1024000 |
|
|
249023963 |
thomas0115 |
B |
March 1, 2024, 4:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
2867200 |
|
|
248924541 |
Forested |
B |
Feb. 29, 2024, 3:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
5017600 |
|
|
248988352 |
Diana773 |
B |
Feb. 29, 2024, 7:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
9113600 |
|
|
248981348 |
STOPTHEWAR |
B |
Feb. 29, 2024, 6:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
9113600 |
|
|
248940988 |
shiqiaqiaya |
B |
Feb. 29, 2024, 3:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
13107200 |
|
|
248944348 |
Kblp_COCu4kA |
B |
Feb. 29, 2024, 3:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
77 |
16588800 |
|
|
248936566 |
EJIC_B_KEDAX |
B |
Feb. 29, 2024, 3:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
78 |
5017600 |
|
|
249029569 |
zhangtianhan |
B |
March 1, 2024, 5:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
78 |
6860800 |
|
|
249021778 |
north_069 |
B |
March 1, 2024, 4:01 a.m. |
OK |
Go |
TESTS |
19 |
217 |
38502400 |
|
|
248984532 |
profchi |
B |
Feb. 29, 2024, 6:56 p.m. |
OK |
Java 21 |
TESTS |
19 |
436 |
21606400 |
|
|
248952527 |
FierteDeCeylan |
B |
Feb. 29, 2024, 3:57 p.m. |
OK |
Java 21 |
TESTS |
19 |
1357 |
67993600 |
|
|
248970769 |
cc4414 |
B |
Feb. 29, 2024, 4:32 p.m. |
OK |
Java 8 |
TESTS |
19 |
421 |
32460800 |
|
|
248935441 |
arvindf232 |
B |
Feb. 29, 2024, 3:25 p.m. |
OK |
Kotlin 1.9 |
TESTS |
19 |
608 |
57446400 |
|
|
248942347 |
6ziv |
B |
Feb. 29, 2024, 3:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
842 |
8908800 |
|
|
249030729 |
Little_Sheep_Yawn |
B |
March 1, 2024, 5:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
295 |
60825600 |
|
|
248981260 |
teekaytai |
B |
Feb. 29, 2024, 6:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
436 |
52121600 |
|
|
248944717 |
dyppp |
B |
Feb. 29, 2024, 3:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
451 |
62771200 |
|
|
248949503 |
alxwen711 |
B |
Feb. 29, 2024, 3:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
514 |
60416000 |
|
|
248948247 |
misorin |
B |
Feb. 29, 2024, 3:49 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
545 |
46592000 |
|
|
248982317 |
titia |
B |
Feb. 29, 2024, 6:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
607 |
66764800 |
|
|
248950810 |
Beacon |
B |
Feb. 29, 2024, 3:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
654 |
71065600 |
|
|
248945067 |
YamOCHca |
B |
Feb. 29, 2024, 3:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
670 |
69120000 |
|
|
248949669 |
yupooh |
B |
Feb. 29, 2024, 3:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
889 |
60313600 |
|
|
248981897 |
hxu10 |
B |
Feb. 29, 2024, 6:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
951 |
48128000 |
|
|
248943056 |
Jimanbanashi |
B |
Feb. 29, 2024, 3:39 p.m. |
OK |
Python 2 |
TESTS |
19 |
1232 |
77004800 |
|
|
248940339 |
shade34 |
B |
Feb. 29, 2024, 3:34 p.m. |
OK |
Python 3 |
TESTS |
19 |
1340 |
94003200 |
|
|
248922936 |
Egor |
B |
Feb. 29, 2024, 3:03 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
93 |
15257600 |
|
|
remove filters
Back to search problems