結果

問題 No.1701 half price
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-12 20:47:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 77,428 KB
最終ジャッジ日時 2023-08-19 23:56:40
合計ジャッジ時間 5,206 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 78 ms
76,096 KB
testcase_10 AC 74 ms
71,320 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 76 ms
76,180 KB
testcase_16 AC 72 ms
71,324 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 71 ms
71,292 KB
testcase_21 AC 629 ms
76,856 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