Submission #14872973


Source Code Expand

Copy
s=''
def readinput():
    global s
    s=input()
    #return s

def find(it,ie):
    global s
    i=it
    while i+1<ie:
        if s[i]=='2':
            if s[i+1]=='5':
                return i
        i+=1
    return -1

def findToken():
    global s
    tokens=[]
    it=find(0,len(s))
    if (it<0):
        return tokens
    ie=it+2
    #print(it,ie)
    lens=len(s)
    while(ie+2<=lens):
        #if s[ie:ie+2]=='25':
        if s[ie]=='2' and s[ie+1]=='5':
            ie+=2
        else:
            #print(it,ie)
            tokens.append(ie-it)
            it=find(ie,lens)
            ie=it+2
    else:
        tokens.append(ie-it)
    return tokens      

def main():
    global s
    tokens=findToken()
    #print(tokens)
    sum=0
    for token in tokens:
        m=token//2
        sum+=m*(m+1)//2
    return sum

if __name__=='__main__':
    readinput()
    ans=main()
    print(ans)

Submission Info

Submission Time
Task B - ニコニコ文字列
User bokukko
Language PyPy3 (7.3.0)
Score 0
Code Size 954 Byte
Status
Exec Time 2209 ms
Memory 162616 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
Subtask1 0 / 30 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
All 0 / 70 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 73 ms 61796 KB
subtask0_sample_02.txt 51 ms 61996 KB
subtask0_sample_03.txt 54 ms 61936 KB
subtask0_sample_04.txt 56 ms 62008 KB
subtask0_sample_05.txt 54 ms 61900 KB
subtask1_01.txt 51 ms 63060 KB
subtask1_02.txt 59 ms 62996 KB
subtask1_03.txt 54 ms 63168 KB
subtask1_04.txt 2209 ms 162400 KB
subtask1_05.txt 2209 ms 157780 KB
subtask1_06.txt 2209 ms 160772 KB
subtask1_07.txt 64 ms 63060 KB
subtask1_08.txt 55 ms 63076 KB
subtask1_09.txt 57 ms 63148 KB
subtask1_10.txt 53 ms 61988 KB
subtask1_11.txt 47 ms 61936 KB
subtask1_12.txt 55 ms 63136 KB
subtask1_13.txt 52 ms 61992 KB
subtask2_01.txt 56 ms 63512 KB
subtask2_02.txt 60 ms 63480 KB
subtask2_03.txt 56 ms 63644 KB
subtask2_04.txt 2208 ms 162232 KB
subtask2_05.txt 2209 ms 162616 KB
subtask2_06.txt 2209 ms 162324 KB
subtask2_07.txt 63 ms 63584 KB
subtask2_08.txt 57 ms 63524 KB
subtask2_09.txt 56 ms 63064 KB
subtask2_10.txt 56 ms 63248 KB
subtask2_11.txt 54 ms 62964 KB
subtask2_12.txt 64 ms 67252 KB