CSES - Datatähti 2022 alku - Results
Submission details
Task:Ositus
Sender:Lexa_ft
Submission time:2021-10-16 19:33:31
Language: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.06 s2, 3details
#60.29 s3details
#7--3details

Code

def funct(nu):
    return 2**(nu-1)



rawin=input()
wordl=len(rawin)
pp=funct(wordl)
val=pp
dupedict={}
rangdict={}
shr=[]
start=[]
stop=[]
yeetus=0
addative=0


for i in range(wordl):
    x=rawin[i]
    if(x in dupedict.keys()):
        continue
    else:
        dlist=[]
        n=0
        while(True):
            m=rawin.find(x,n)
            if(m==-1):
                break
            dlist.append(m)
            n=m+1
        dupedict[x]=dlist



for ke in dupedict:
    dlist=dupedict[ke]
    if(len(dlist)>1):
        ranges=[]
        for i in range(len(dlist)-1):
            start.append(int(dlist[i]))
            stop.append(int(dlist[i+1]))
            ranges.append(stop[-1]-start[-1]+1)
        rangdict[ke]=ranges



for i in range(len(start)):
    yeetus+=funct(wordl-(stop[i]-start[i]))
    for j in range(len(start)):
        if(start[j]>start[i] and start[j]<stop[i]):
            addative+=1



for k1 in rangdict:   
    for k2 in rangdict:
        if(k1!=k2):
            l1=rangdict[k1]
            l2=rangdict[k2]
            for i in range(len(l1)):
                for j in range(len(l2)):
                    if(l1[i]+l2[j]<=wordl):
                        addative+=1




output=(val+addative-yeetus)%(10**9+7)

print(output)

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
999999871

Test 4

Group: 1, 2, 3

Verdict:

input
aaxxxxxxaa

correct output
4

user output
999998758

Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
603711675

Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
461085829

Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)