結果

問題 No.1457 ツブ消ししとるなHard
ユーザー あかりきあかりき
提出日時 2021-04-13 17:57:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 125,928 KB
最終ジャッジ日時 2023-09-12 10:18:41
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,788 KB
testcase_01 AC 90 ms
71,628 KB
testcase_02 AC 89 ms
71,636 KB
testcase_03 AC 88 ms
71,728 KB
testcase_04 AC 207 ms
103,708 KB
testcase_05 AC 218 ms
105,024 KB
testcase_06 AC 283 ms
125,928 KB
testcase_07 AC 89 ms
71,452 KB
testcase_08 AC 89 ms
71,608 KB
testcase_09 AC 114 ms
78,300 KB
testcase_10 AC 112 ms
78,160 KB
testcase_11 AC 98 ms
76,256 KB
testcase_12 AC 134 ms
84,232 KB
testcase_13 AC 117 ms
80,884 KB
testcase_14 AC 100 ms
76,312 KB
testcase_15 AC 124 ms
80,180 KB
testcase_16 AC 159 ms
85,940 KB
testcase_17 AC 89 ms
71,668 KB
testcase_18 AC 90 ms
71,576 KB
testcase_19 AC 152 ms
83,860 KB
testcase_20 AC 89 ms
71,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
n,m,x,y,z=map(int,input().split())
a=list(map(int,input().split()))

L=[]
L2=[]
for i in range(n):
  if a[i]>=x:
    L.append(a[i])
  elif a[i]>y:
    L2.append(a[i])

if len(L)>m:
  print('Handicapped')
  exit()

n=len(L2)
if len(L2)!=0:
  M=max(L2)
else:
  M=0
m-=len(L)
L3=[[[0]*(M*m+1) for i in range(m+1)] for j in range(n+1)]

for i3 in range(n+1):
  for i2 in range(m+1):
    for i1 in range(M*m+1):
      if i1==0 and i2==0 and i3==0:
        L3[i3][i2][i1]=1
      elif i3>0 and i1<L2[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]
      elif i3>0 and i2>0 and i1>=L2[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]+L3[i3-1][i2-1][i1-L2[i3-1]]
      else:
        L3[i3][i2][i1]=0
ct=0
for i2 in range(m+1):
  for i1 in range(1,M*m+1):
    if (i2+len(L))*z==i1+sum(L):
      ct+=L3[n][i2][i1]
print(ct)
0