結果
| 問題 | 
                            No.1535 五七五
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2021-06-06 18:45:40 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,416 ms / 2,000 ms | 
| コード長 | 377 bytes | 
| コンパイル時間 | 110 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 53,988 KB | 
| 最終ジャッジ日時 | 2024-11-23 03:37:55 | 
| 合計ジャッジ時間 | 12,543 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
from itertools import accumulate
import bisect
N=int(input())
a,b,c=map(int,input().split())
S=input().split()
S=[len(s) for s in S]
A=[0]+list(accumulate(S))
ANS=0
for i in range(N):
    x=A[i]
    y=bisect.bisect(A,x+a)
    z=bisect.bisect(A,x+a+b)
    w=bisect.bisect(A,x+a+b+c)
    if A[y-1]==x+a and A[z-1]==x+a+b and A[w-1]==x+a+b+c:
        ANS+=1
    
print(ANS)
            
            
            
        
            
titia