提出 #70608584


ソースコード 拡げる

N,A,B = map(int,input().split())
S = str(input())

ab = [[0,0]]

for i in range(N):
    AAA = 0
    BBB = 0
    if S[i] == 'a': AAA += 1
    else: BBB += 1
    ab += [[ab[-1][0]+AAA,ab[-1][1]+BBB]]

Ans = 0

for i in range(1,N+1):
    for j in range(0,N-i+1):
        Temp = [ab[j+i-1][0]-ab[j][0],ab[j+i-1][1]-ab[j][1]]
        if Temp[0] >= A and Temp[1] < B: Ans += 1

print(Ans)

提出情報

提出日時
問題 C - Truck Driver
ユーザ NNN_125128
言語 Python (PyPy 3.11-v7.3.20)
得点 0
コード長 401 Byte
結果 WA
実行時間 > 2000 ms
メモリ 144388 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 2
AC × 2
WA × 1
TLE × 22
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All hand.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
hand.txt WA 49 ms 79420 KiB
random_01.txt TLE > 2000 ms 144144 KiB
random_02.txt TLE > 2000 ms 144240 KiB
random_03.txt TLE > 2000 ms 144180 KiB
random_04.txt TLE > 2000 ms 144100 KiB
random_05.txt TLE > 2000 ms 144164 KiB
random_06.txt TLE > 2000 ms 144224 KiB
random_07.txt TLE > 2000 ms 144388 KiB
random_08.txt TLE > 2000 ms 144352 KiB
random_09.txt TLE > 2000 ms 143420 KiB
random_10.txt TLE > 2000 ms 143416 KiB
random_11.txt TLE > 2000 ms 143020 KiB
random_12.txt TLE > 2000 ms 143468 KiB
random_13.txt TLE > 2000 ms 143404 KiB
random_14.txt TLE > 2000 ms 143416 KiB
random_15.txt TLE > 2000 ms 143244 KiB
random_16.txt TLE > 2000 ms 144316 KiB
random_17.txt TLE > 2000 ms 144324 KiB
random_18.txt TLE > 2000 ms 144152 KiB
random_19.txt TLE > 2000 ms 143396 KiB
random_20.txt TLE > 2000 ms 143292 KiB
random_21.txt TLE > 2000 ms 143560 KiB
random_22.txt TLE > 2000 ms 143172 KiB
sample_01.txt AC 50 ms 79876 KiB
sample_02.txt AC 50 ms 79716 KiB