結果

問題 No.1535 五七五
ユーザー とりゐとりゐ
提出日時 2021-05-12 01:45:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 889 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 109,272 KB
最終ジャッジ日時 2024-04-21 22:10:40
合計ジャッジ時間 7,999 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 27 ms
10,496 KB
testcase_03 AC 30 ms
10,496 KB
testcase_04 AC 812 ms
77,208 KB
testcase_05 AC 864 ms
100,064 KB
testcase_06 AC 889 ms
109,272 KB
testcase_07 AC 28 ms
10,624 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 27 ms
10,624 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 26 ms
10,624 KB
testcase_12 AC 26 ms
10,752 KB
testcase_13 AC 27 ms
10,624 KB
testcase_14 AC 26 ms
10,752 KB
testcase_15 AC 27 ms
10,624 KB
testcase_16 AC 27 ms
10,752 KB
testcase_17 AC 27 ms
10,496 KB
testcase_18 AC 609 ms
64,420 KB
testcase_19 AC 578 ms
60,716 KB
testcase_20 AC 586 ms
61,316 KB
testcase_21 AC 607 ms
65,292 KB
testcase_22 AC 604 ms
67,040 KB
testcase_23 AC 572 ms
64,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a,b,c=map(int,input().split())
s=tuple(map(str,input().split()))
t=[len(i) for i in s]

def f(m):
  check=[-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:
      check[L]=R+1
    tmp-=t[L]
  return check

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