結果
| 問題 | 
                            No.1535 五七五
                             | 
                    
| コンテスト | |
| ユーザー | 
                             とりゐ
                         | 
                    
| 提出日時 | 2021-05-11 23:26:22 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 226 ms / 2,000 ms | 
| コード長 | 433 bytes | 
| コンパイル時間 | 202 ms | 
| コンパイル使用メモリ | 81,860 KB | 
| 実行使用メモリ | 168,236 KB | 
| 最終ジャッジ日時 | 2024-10-13 20:35:09 | 
| 合計ジャッジ時間 | 3,745 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
n=int(input())
a,b,c=map(int,input().split())
s=list(map(str,input().split()))
t=[len(i) for i in s]
def f(m):
  cnt=[-1]*n
  tmp=0
  R=-1
  for L in range(n):
    while tmp<m and R<n-1:
      R+=1
      tmp+=t[R]
    if tmp==m:
      cnt[L]=R+1
    tmp-=t[L]
  return cnt
A=f(a)
B=f(b)
C=f(c)
ans=0
for i in range(n):
  if A[i]!=-1:
    if A[i]<n and B[A[i]]!=-1:
      if B[A[i]]<n and C[B[A[i]]]!=-1:
        ans+=1
print(ans)
            
            
            
        
            
とりゐ