Submission #5240751


Source Code Expand

import re
import numpy as np

T = int(input())
S = [input() for i in range(T)]

for i in range(len(S)):
    text = S[i]
    to = text.count('tokyo')
    ky = text.count('kyoto')
    n = to + ky
    #print(n)
    target = 'tokyo'
    start = []
    index = -1
    while True:
        index = text.find(target, index + 1)
        if index == -1:
            break
        start.append(int(index))
    target = 'kyoto'
    index = -1
    while True:
        index = text.find(target, index + 1)
        if index == -1:
            break
        start.append(int(index))
    nstart=np.array(sorted(start))
    #print(nstart)
    stop = nstart + 4
    #print(stop)
    
    s = nstart
    t = stop
    itv = []
    for i in range(n):
        itv.append([t[i],s[i]])
    itv.sort()

    ass = 0
    tt = 0
    for i in range(n):
        if tt < itv[i][1]:
            ass += 1
            tt = itv[i][0]
    print(ass)

Submission Info

Submission Time
Task A - 東京都
User tk42710
Language Python (3.4.3)
Score 0
Code Size 957 Byte
Status WA
Exec Time 154 ms
Memory 12404 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt WA 153 ms 12404 KB
20_noised_tokyoto.txt WA 154 ms 12404 KB
99_teuchi.txt WA 152 ms 12404 KB