結果

問題 No.1701 half price
ユーザー ygd.ygd.
提出日時 2021-10-10 10:39:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 78,020 KB
最終ジャッジ日時 2023-10-12 05:28:13
合計ジャッジ時間 5,952 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,356 KB
testcase_01 AC 74 ms
76,184 KB
testcase_02 AC 132 ms
76,456 KB
testcase_03 AC 75 ms
76,636 KB
testcase_04 AC 135 ms
76,664 KB
testcase_05 AC 80 ms
76,244 KB
testcase_06 AC 634 ms
76,884 KB
testcase_07 AC 638 ms
77,164 KB
testcase_08 WA -
testcase_09 AC 74 ms
76,084 KB
testcase_10 AC 70 ms
71,488 KB
testcase_11 AC 75 ms
75,912 KB
testcase_12 AC 74 ms
76,088 KB
testcase_13 AC 74 ms
76,072 KB
testcase_14 AC 72 ms
76,032 KB
testcase_15 AC 73 ms
76,028 KB
testcase_16 AC 69 ms
71,500 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 70 ms
71,320 KB
testcase_21 AC 629 ms
76,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
#input = sys.stdin.buffer.readline
import itertools

def main():
    N,W = map(int,input().split())
    A = list(map(int,input().split()))
    sgn = [0,1,2]
    ans = set([])
    for L in itertools.product(sgn,repeat=N):
        temp = 0
        used = []
        for i,x in enumerate(L):
            if x == 1:
                temp += A[i]
                used.append(i)
            if x == 2:
                temp += A[i]//2
                used.append(i)
        if temp == W:
            used.sort()
            tused = tuple(used)
            ans.add(tused)

    print(len(ans))



if __name__ == '__main__':
    main()
0