結果

問題 No.1701 half price
ユーザー HydruHydru
提出日時 2021-10-08 22:26:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 77,168 KB
最終ジャッジ日時 2023-09-30 10:56:33
合計ジャッジ時間 3,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,556 KB
testcase_01 AC 72 ms
71,620 KB
testcase_02 AC 107 ms
76,888 KB
testcase_03 AC 72 ms
71,556 KB
testcase_04 AC 107 ms
77,168 KB
testcase_05 AC 81 ms
76,736 KB
testcase_06 AC 301 ms
77,168 KB
testcase_07 AC 266 ms
77,064 KB
testcase_08 WA -
testcase_09 AC 71 ms
71,336 KB
testcase_10 AC 70 ms
71,572 KB
testcase_11 AC 72 ms
71,188 KB
testcase_12 AC 72 ms
71,556 KB
testcase_13 AC 72 ms
71,420 KB
testcase_14 AC 70 ms
71,228 KB
testcase_15 AC 71 ms
71,492 KB
testcase_16 AC 72 ms
71,448 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 71 ms
71,356 KB
testcase_21 AC 334 ms
77,060 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
    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