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 binary string t of length 10^{100} , and initally all of its bits are texttt{0} . You are given a binary string s , and perform the following operation some times: Find the lexicographically largest ^ ddagger string t satisfying these constraints, or report that no such string exists. ^ dagger Formally, choose an index i such that 0 <= q i <= q 10^{100}-|s| . For all 1 <= q j <= q |s| , if s_j = texttt{1} , then toggle t_{i+j} . That is, if t_{i+j}= texttt{0} , set t_{i+j}= texttt{1} . Otherwise if t_{i+j}= texttt{1} , set t_{i+j}= texttt{0} . ^ ddagger A binary string a is lexicographically larger than a binary string b of the same length if in the first position where a and b differ, the string a has a bit texttt{1} and the corresponding bit in b is texttt{0} . The only line of each test contains a single binary string s ( 1 <= q |s| <= q 35 ). If no string t exists as described in the statement, output -1. Otherwise, output the integers p and q ( 1 <= q p < q <= q 10^{100} ) such that the p -th and q -th bits of the lexicographically maximal t are texttt{1} . In the first test, you can perform the following operations. texttt{00000} ldots to color{red}{ texttt{1}} texttt{0000} ldots to texttt{1} color{red}{ texttt{1}} texttt{000} ldots In the second test, you can perform the following operations. texttt{00000} ldots to color{red}{ texttt{001}} texttt{00} ldots to texttt{0} color{red}{ texttt{011}} texttt{0} ldots In the third test, you can perform the following operations. texttt{00000} ldots to color{red}{ texttt{1111}} texttt{0} ldots to texttt{1} color{red}{ texttt{0001}} ldots It can be proven that these strings t are the lexicographically largest ones. In the fourth test, you can't make a "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
162160053 |
flamestorm |
G |
June 28, 2022, 5:39 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
46 |
0 |
|
|
162180054 |
Agreb |
G |
June 28, 2022, 9:58 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
124 |
512000 |
|
|
162187093 |
Deaga |
G |
June 29, 2022, 1:19 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
218 |
8704000 |
|
|
162181184 |
Kilani |
G |
June 28, 2022, 10:27 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
811 |
10752000 |
|
|
162171925 |
errorgorn |
G |
June 28, 2022, 7:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
15 |
0 |
|
|
162158514 |
A_G |
G |
June 28, 2022, 5:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
15 |
0 |
|
|
162188631 |
Sonnoz |
G |
June 29, 2022, 1:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
0 |
|
|
162154766 |
dreamoon_love_AA |
G |
June 28, 2022, 4:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
7372800 |
|
|
162161087 |
SHZhang |
G |
June 28, 2022, 5:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
0 |
|
|
162157119 |
BurnedChicken |
G |
June 28, 2022, 5:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
187 |
8499200 |
|
|
162156655 |
ksun48 |
G |
June 28, 2022, 5:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
592 |
5120000 |
|
|
remove filters
Back to search problems