結果

問題 No.1535 五七五
ユーザー とりゐとりゐ
提出日時 2021-05-11 23:26:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 168,368 KB
最終ジャッジ日時 2024-04-21 22:10:51
合計ジャッジ時間 4,067 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 43 ms
51,968 KB
testcase_03 AC 39 ms
51,968 KB
testcase_04 AC 187 ms
153,560 KB
testcase_05 AC 226 ms
160,556 KB
testcase_06 AC 192 ms
168,368 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 39 ms
52,224 KB
testcase_09 AC 39 ms
51,968 KB
testcase_10 AC 38 ms
52,096 KB
testcase_11 AC 38 ms
51,968 KB
testcase_12 AC 38 ms
51,968 KB
testcase_13 AC 39 ms
52,492 KB
testcase_14 AC 38 ms
52,224 KB
testcase_15 AC 38 ms
51,968 KB
testcase_16 AC 39 ms
51,712 KB
testcase_17 AC 38 ms
52,096 KB
testcase_18 AC 227 ms
166,228 KB
testcase_19 AC 263 ms
166,176 KB
testcase_20 AC 234 ms
166,444 KB
testcase_21 AC 247 ms
165,908 KB
testcase_22 AC 237 ms
166,172 KB
testcase_23 AC 227 ms
166,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0