CSES - Datatähti 2022 alku - Results
Submission details
Task:Ositus (Partitioning)
Sender:Katto
Submission time:2021-10-09 22:51:36
Language:CPython3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.02 s1, 2, 3details
#20.02 s1, 2, 3details
#3--1, 2, 3details
#4--1, 2, 3details
#5--2, 3details
#6--3details
#7--3details

Code

string = input()
mod = int(1e9+7)
ans = (1 << (len(string)-1)) - 1 % mod

for ch in string:
    if string.count(ch) > 1:
        count = string.count(ch)
        if count > 1:
            x1 = string.find(ch)
            x2 = string.find(ch, x1)
        while True:
            ans = (ans - (1 << (x1-x2+len(string)-1))) % mod
            count -= 1
            if count > 1:
                x1 = x2
                x2 = string.find(ch, x2)

print(ans)

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
a

correct output
1

user output
0

Test 2

Group: 1, 2, 3

Verdict:

input
abcdefghij

correct output
512

user output
511

Test 3

Group: 1, 2, 3

Verdict:

input
abcabaacbc

correct output
120

user output
(empty)

Test 4

Group: 1, 2, 3

Verdict:

input
aaxxxxxxaa

correct output
4

user output
(empty)

Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
(empty)

Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
(empty)

Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)