結果

問題 No.1701 half price
ユーザー HydruHydru
提出日時 2021-10-08 22:28:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-09-30 11:02:54
合計ジャッジ時間 3,758 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,340 KB
testcase_01 AC 72 ms
71,116 KB
testcase_02 AC 109 ms
76,944 KB
testcase_03 AC 73 ms
71,432 KB
testcase_04 AC 115 ms
76,936 KB
testcase_05 AC 83 ms
76,488 KB
testcase_06 AC 302 ms
76,856 KB
testcase_07 AC 265 ms
76,856 KB
testcase_08 WA -
testcase_09 AC 75 ms
71,272 KB
testcase_10 AC 73 ms
71,328 KB
testcase_11 AC 74 ms
71,272 KB
testcase_12 AC 72 ms
71,236 KB
testcase_13 AC 74 ms
71,124 KB
testcase_14 AC 73 ms
71,116 KB
testcase_15 AC 73 ms
71,436 KB
testcase_16 AC 74 ms
71,140 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
71,320 KB
testcase_21 AC 83 ms
76,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w=map(int,input().split())
A=list(map(int,input().split()))
ans=0
for i in range(1<<n):
    ind=[]
    sum=0
    cnt=0
    for j in range(n):
        if i & 1<<j:
            sum+=A[j]
            ind.append(j)
            cnt+=1
    if sum<w:
        continue
    for j in range(1<<cnt):
        tmpSum=sum
        for k in range(cnt):
            if j & 1<<k:
                tmpSum-=A[ind[k]]//2
        if tmpSum==w:
            ans+=1
            break
        
print(ans)
0