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'In a desperate attempt to obtain your waifu favorite character, you have hacked into the source code of the game. After days of struggling, you finally find the binary string that encodes the gacha system of the game. In order to decode it, you must first solve the following problem. You are given a binary string s of length n . For each pair of integers (l, r) (1 <= q l <= q r <= q n) , count the number of pairs (x, y) (l <= q x <= q y <= q r) such that the amount of mathtt{0} equals the amount of mathtt{1} in the substring s_xs_{x+1}...s_y . Output the sum of counts over all possible (l, r) modulo 10^9+7 . The first line contains t ( 1 <= q t <= q 1000 ) -- the number of test cases. Each test case contains a binary string s ( 1 <= q |s| <= q 2 cdot 10^5 ). It is guaranteed s only contains characters mathtt{0} and mathtt{1} . It is guaranteed the sum of |s| over all test cases does not exceed 2 cdot 10^5 . For each test case, output an integer, the answer modulo 10^9+7 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
272889918 |
sergio.moncada1 |
E |
July 27, 2024, 2:08 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
61 |
819200 |
|
|
272904562 |
KagariII |
E |
July 27, 2024, 4:52 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
819200 |
|
|
272858894 |
loneWA |
E |
July 26, 2024, 6:07 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
819200 |
|
|
272866801 |
jha_rishi |
E |
July 26, 2024, 7:18 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
1638400 |
|
|
272880343 |
lzh999 |
E |
July 26, 2024, 10:45 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
3481600 |
|
|
272893347 |
Plossom |
E |
July 27, 2024, 2:49 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
4812800 |
|
|
272890781 |
ilija_IR_13 |
E |
July 27, 2024, 2:18 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
4812800 |
|
|
272880086 |
yatharthsinghal1 |
E |
July 26, 2024, 10:40 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
4915200 |
|
|
272849600 |
khamar |
E |
July 26, 2024, 5:03 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
62 |
20684800 |
|
|
272865317 |
GaurishS |
E |
July 26, 2024, 7:02 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
15 |
77 |
716800 |
|
|
272880046 |
FzArK |
E |
July 26, 2024, 10:39 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
0 |
|
|
272853014 |
acfmidinsw |
E |
July 26, 2024, 5:30 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
102400 |
|
|
272883870 |
lucasaamorim |
E |
July 27, 2024, 12:18 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
1638400 |
|
|
272874377 |
iagozag |
E |
July 26, 2024, 8:56 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
1638400 |
|
|
272900821 |
ShirasuAzusa |
E |
July 27, 2024, 4:10 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
2969600 |
|
|
272890264 |
NortGlG |
E |
July 27, 2024, 2:12 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
46 |
3993600 |
|
|
272901114 |
__New_coder |
E |
July 27, 2024, 4:14 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
61 |
0 |
|
|
272882511 |
aziz451 |
E |
July 26, 2024, 11:42 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
61 |
102400 |
|
|
272905252 |
abhinavjais455 |
E |
July 27, 2024, 4:59 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
61 |
614400 |
|
|
272896852 |
hannnnpiggy |
E |
July 27, 2024, 3:27 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
61 |
819200 |
|
|
272908564 |
hubbya |
E |
July 27, 2024, 5:28 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272905176 |
Tangle-d |
E |
July 27, 2024, 4:58 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272893599 |
rxeee123123 |
E |
July 27, 2024, 2:52 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272870222 |
dreamskycx |
E |
July 26, 2024, 8 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272859152 |
TIHOVNO |
E |
July 26, 2024, 6:09 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272857935 |
neal |
E |
July 26, 2024, 6 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
0 |
|
|
272911903 |
raj_naitik |
E |
July 27, 2024, 5:56 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
921600 |
|
|
272907928 |
chowgz |
E |
July 27, 2024, 5:23 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
921600 |
|
|
272900279 |
m_nature |
E |
July 27, 2024, 4:04 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
921600 |
|
|
272876690 |
Xing_Kong_C |
E |
July 26, 2024, 9:35 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
46 |
921600 |
|
|
272869406 |
yash_04 |
E |
July 26, 2024, 7:49 p.m. |
OK |
Go |
TESTS |
15 |
77 |
7270400 |
|
|
272858376 |
sahasrad |
E |
July 26, 2024, 6:03 p.m. |
OK |
Java 21 |
TESTS |
15 |
250 |
716800 |
|
|
272882632 |
G8L18M |
E |
July 26, 2024, 11:46 p.m. |
OK |
Java 21 |
TESTS |
15 |
281 |
819200 |
|
|
272875972 |
rik__27 |
E |
July 26, 2024, 9:23 p.m. |
OK |
Java 21 |
TESTS |
15 |
296 |
1126400 |
|
|
272883411 |
gdax |
E |
July 27, 2024, 12:06 a.m. |
OK |
Java 21 |
TESTS |
15 |
296 |
12185600 |
|
|
272855571 |
Required |
E |
July 26, 2024, 5:43 p.m. |
OK |
Java 21 |
TESTS |
15 |
296 |
12902400 |
|
|
272883906 |
Hastorius |
E |
July 27, 2024, 12:19 a.m. |
OK |
Java 21 |
TESTS |
15 |
296 |
13004800 |
|
|
272882475 |
Mysterious-_-joker |
E |
July 26, 2024, 11:41 p.m. |
OK |
Java 21 |
TESTS |
15 |
312 |
1024000 |
|
|
272902689 |
Baski_Flex |
E |
July 27, 2024, 4:32 a.m. |
OK |
Java 21 |
TESTS |
15 |
312 |
18124800 |
|
|
272861627 |
sajjan28yadav |
E |
July 26, 2024, 6:27 p.m. |
OK |
Java 21 |
TESTS |
15 |
327 |
14643200 |
|
|
272901637 |
priyaroy3370 |
E |
July 27, 2024, 4:20 a.m. |
OK |
Java 21 |
TESTS |
15 |
327 |
14848000 |
|
|
272868112 |
kasiru_69 |
E |
July 26, 2024, 7:33 p.m. |
OK |
Java 8 |
TESTS |
15 |
171 |
3686400 |
|
|
272866552 |
CipherSphinx_Raj |
E |
July 26, 2024, 7:15 p.m. |
OK |
Java 8 |
TESTS |
15 |
171 |
39116800 |
|
|
272907601 |
arajeev210 |
E |
July 27, 2024, 5:20 a.m. |
OK |
Java 8 |
TESTS |
15 |
187 |
4403200 |
|
|
272883367 |
PassedPawn |
E |
July 27, 2024, 12:05 a.m. |
OK |
Java 8 |
TESTS |
15 |
202 |
3891200 |
|
|
272855009 |
Harman_Singh |
E |
July 26, 2024, 5:40 p.m. |
OK |
Java 8 |
TESTS |
15 |
202 |
15769600 |
|
|
272884025 |
leonlian |
E |
July 27, 2024, 12:22 a.m. |
OK |
Java 8 |
TESTS |
15 |
234 |
15052800 |
|
|
272880832 |
white___devil |
E |
July 26, 2024, 10:59 p.m. |
OK |
Java 8 |
TESTS |
15 |
249 |
10444800 |
|
|
272880778 |
Sumitsingh7 |
E |
July 26, 2024, 10:57 p.m. |
OK |
Java 8 |
TESTS |
15 |
265 |
19968000 |
|
|
272894521 |
BlizGale |
E |
July 27, 2024, 3:01 a.m. |
OK |
Java 8 |
TESTS |
15 |
327 |
16281600 |
|
|
272906817 |
Your6QwQ |
E |
July 27, 2024, 5:13 a.m. |
OK |
Java 8 |
TESTS |
15 |
359 |
29593600 |
|
|
272900587 |
raunakgiri21 |
E |
July 27, 2024, 4:07 a.m. |
OK |
Node.js |
TESTS |
15 |
124 |
22323200 |
|
|
272868753 |
KA_Rma |
E |
July 26, 2024, 7:41 p.m. |
OK |
PyPy 3 |
TESTS |
15 |
171 |
10342400 |
|
|
272855429 |
shilpabanerjee50 |
E |
July 26, 2024, 5:42 p.m. |
OK |
PyPy 3 |
TESTS |
15 |
202 |
9318400 |
|
|
272861897 |
9r3r |
E |
July 26, 2024, 6:29 p.m. |
OK |
PyPy 3 |
TESTS |
15 |
218 |
14028800 |
|
|
272903866 |
pulkit_garg14 |
E |
July 27, 2024, 4:44 a.m. |
OK |
PyPy 3 |
TESTS |
15 |
234 |
21401600 |
|
|
272849440 |
satwikr78 |
E |
July 26, 2024, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
93 |
6758400 |
|
|
272909357 |
Heisenberg2020 |
E |
July 27, 2024, 5:35 a.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
93 |
7372800 |
|
|
272911832 |
fancyalad |
E |
July 27, 2024, 5:55 a.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
108 |
6758400 |
|
|
272874228 |
kkkk1234 |
E |
July 26, 2024, 8:53 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
108 |
6758400 |
|
|
272912663 |
camc |
E |
July 27, 2024, 6:02 a.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
5222400 |
|
|
272850066 |
stucco7 |
E |
July 26, 2024, 5:04 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
6860800 |
|
|
272870042 |
ahilaan |
E |
July 26, 2024, 7:58 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
10854400 |
|
|
272880291 |
kinglykang |
E |
July 26, 2024, 10:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
12083200 |
|
|
272862898 |
DeepJ |
E |
July 26, 2024, 6:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
12492800 |
|
|
272862688 |
DeepJ |
E |
July 26, 2024, 6:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
109 |
12492800 |
|
|
272849806 |
Birjis_48 |
E |
July 26, 2024, 5:04 p.m. |
OK |
Python 2 |
TESTS |
15 |
233 |
10752000 |
|
|
272852020 |
BadCodeBuilder |
E |
July 26, 2024, 5:26 p.m. |
OK |
Python 3 |
TESTS |
15 |
155 |
13721600 |
|
|
272867203 |
prathamsibal81 |
E |
July 26, 2024, 7:23 p.m. |
OK |
Python 3 |
TESTS |
15 |
186 |
14438400 |
|
|
272849756 |
sarkardhiraj279 |
E |
July 26, 2024, 5:04 p.m. |
OK |
Python 3 |
TESTS |
15 |
187 |
14233600 |
|
|
272849513 |
Nani_6556 |
E |
July 26, 2024, 5:03 p.m. |
OK |
Python 3 |
TESTS |
15 |
218 |
14233600 |
|
|
272865943 |
deadshot_24 |
E |
July 26, 2024, 7:09 p.m. |
OK |
Python 3 |
TESTS |
15 |
265 |
19763200 |
|
|
272900261 |
rohanmitra2420 |
E |
July 27, 2024, 4:03 a.m. |
OK |
Python 3 |
TESTS |
15 |
265 |
19865600 |
|
|
272903745 |
zzczzzzz |
E |
July 27, 2024, 4:43 a.m. |
OK |
Rust 2021 |
TESTS |
15 |
46 |
1433600 |
|
|
272871426 |
fieubat2x |
E |
July 26, 2024, 8:15 p.m. |
OK |
Rust 2021 |
TESTS |
15 |
46 |
2252800 |
|
|
272894302 |
DATVN |
E |
July 27, 2024, 2:59 a.m. |
OK |
Rust 2021 |
TESTS |
15 |
62 |
2150400 |
|
|
272849406 |
Kerplunk |
E |
July 26, 2024, 5:03 p.m. |
OK |
Rust 2021 |
TESTS |
15 |
77 |
11571200 |
|
|
remove filters
Back to search problems