結果

問題 No.1701 half price
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-12 20:47:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 77,804 KB
最終ジャッジ日時 2023-08-19 23:56:34
合計ジャッジ時間 5,423 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 73 ms
76,392 KB
testcase_10 AC 68 ms
71,248 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 70 ms
76,256 KB
testcase_16 AC 69 ms
71,364 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 68 ms
71,408 KB
testcase_21 AC 611 ms
77,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n,w=map(int,input().split())
a=list(map(int,input().split()))
ans=0

for i in product([0,1],repeat=n):
    t=i.count(1)
    if t == 0:
        continue
    for j in product([0,1],repeat=t):
        indj=0
        cntw=0
        for k in range(n):
            if i[k] == 1:
                if j[indj] == 1:
                    cntw += a[k]//2
                else:
                    cntw += a[k]
                indj+=1
        
        if cntw == w:
            print(i,j)
            ans+=1
            break
                
print(ans)
0