結果

問題 No.1535 五七五
ユーザー ygd.ygd.
提出日時 2021-06-10 22:25:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 790 bytes
コンパイル時間 1,215 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 194,168 KB
最終ジャッジ日時 2023-08-20 08:29:27
合計ジャッジ時間 7,170 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
75,620 KB
testcase_01 AC 75 ms
71,304 KB
testcase_02 AC 77 ms
71,248 KB
testcase_03 AC 75 ms
71,104 KB
testcase_04 AC 224 ms
176,780 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    a,b,c = map(int,input().split())
    S = list(map(str,input().split()))
    cumsum = [0]
    for i in range(N):
        temp = cumsum[-1] + len(S[i])
        cumsum.append(temp)
    #print(cumsum)
    r = 0
    ans = 0
    for l in range(N):
        while r < N and cumsum[r] - cumsum[l] < a+b+c:
            r += 1
        if cumsum[r] - cumsum[l] == a+b+c:
            p = l
            while cumsum[p] - cumsum[l] < a:
                p += 1
            q = r
            while cumsum[r] - cumsum[q] < c:
                q -= 1
            if cumsum[r] - cumsum[q] == c and cumsum[q] - cumsum[p] == b and cumsum[p] - cumsum[l] == a:
                ans += 1
        if l == r:
            r += 1
    print(ans)


if __name__ == '__main__':
    main()
0