Submission #14873093


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=0
    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)
            m=(ie-it)//2
            tokens+=m*(m+1)//2
            it=find(ie,lens)
            ie=it+2
    else:
        m=(ie-it)//2
        tokens+=m*(m+1)//2
    return tokens      

def main():
    global s
    tokens=findToken()
    #print(tokens)
    return tokens

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 918 Byte
Status
Exec Time 2207 ms
Memory 73188 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 66 ms 61976 KB
subtask0_sample_02.txt 59 ms 61764 KB
subtask0_sample_03.txt 48 ms 62036 KB
subtask0_sample_04.txt 54 ms 61996 KB
subtask0_sample_05.txt 54 ms 62068 KB
subtask1_01.txt 57 ms 63244 KB
subtask1_02.txt 54 ms 62904 KB
subtask1_03.txt 58 ms 63148 KB
subtask1_04.txt 2207 ms 73112 KB
subtask1_05.txt 2207 ms 72856 KB
subtask1_06.txt 2207 ms 73084 KB
subtask1_07.txt 68 ms 63256 KB
subtask1_08.txt 56 ms 63140 KB
subtask1_09.txt 58 ms 62980 KB
subtask1_10.txt 50 ms 61804 KB
subtask1_11.txt 55 ms 61984 KB
subtask1_12.txt 58 ms 63356 KB
subtask1_13.txt 59 ms 62068 KB
subtask2_01.txt 60 ms 63712 KB
subtask2_02.txt 57 ms 63232 KB
subtask2_03.txt 58 ms 63448 KB
subtask2_04.txt 2207 ms 73188 KB
subtask2_05.txt 2207 ms 72920 KB
subtask2_06.txt 2207 ms 73000 KB
subtask2_07.txt 71 ms 63744 KB
subtask2_08.txt 56 ms 63768 KB
subtask2_09.txt 58 ms 63080 KB
subtask2_10.txt 48 ms 63340 KB
subtask2_11.txt 51 ms 63204 KB
subtask2_12.txt 62 ms 65904 KB