CSES - Datatähti 2022 alku - Results
Submission details
Task:Ositus
Sender:Lizene
Submission time:2021-10-17 19:43:00 +0300
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.04 s1, 2, 3details
#2ACCEPTED0.04 s1, 2, 3details
#30.04 s1, 2, 3details
#40.04 s1, 2, 3details
#50.05 s2, 3details
#60.57 s3details
#7--3details

Code

jono_o = input()
alphabet = "abcdefghijklmnopqrstuvxyz"
x = 0
def find_all(string, character):
    indexes = []
    for i, c in enumerate(string):
        if c == character:
            indexes.append(i)
    return indexes
for k in alphabet:
    jono = jono_o
    if jono.count(k)>1:
        ind = find_all(jono, k)
        p = 0
        for h in range(jono.count(k)-1):
            x += 2**(len(jono[:ind[h]])+len(jono[ind[h+1]+1:]))
varasto = ""
virheet = 0
taso = 1
jono = jono_o
hik = True
jik = True
olivirhe = False
while taso < 10:
    ensivirhe = -1
    while hik == True:
        for i, k in enumerate(jono[ensivirhe+1:], start=ensivirhe+1):
            if varasto.count(k)>=1:
                virheet += 1
                if virheet == 1:
                    ind = find_all(jono[:i], k)
                    ensivirhe = ind[-1]
            varasto = varasto + k
            if virheet > taso:
                x -= 2**(len(jono[:ensivirhe])+len(jono[i+1:]))
                if olivirhe == False:
                    olivirhe = True
                break
            if i == len(jono)-1:
                hik = False
        varasto = ""        
        virheet = 0
    hik = True
    if olivirhe == False:
        break
    olivirhe = False
    taso += 1

vastaus = 2**(len(jono_o)-1)-x
print(vastaus%(10**9+7))

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
a

correct output
1

user output
1

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
abcdefghij

correct output
512

user output
512

Test 3

Group: 1, 2, 3

Verdict:

input
abcabaacbc

correct output
120

user output
165

Test 4

Group: 1, 2, 3

Verdict:

input
aaxxxxxxaa

correct output
4

user output
999999766

Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
175355040

Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
397384192

Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)