結果

問題 No.1701 half price
ユーザー tassei903tassei903
提出日時 2021-10-08 22:18:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 586 ms / 3,000 ms
コード長 723 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-09-30 10:40:20
合計ジャッジ時間 4,637 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,000 KB
testcase_01 AC 75 ms
76,192 KB
testcase_02 AC 117 ms
76,864 KB
testcase_03 AC 76 ms
76,204 KB
testcase_04 AC 117 ms
76,856 KB
testcase_05 AC 78 ms
76,460 KB
testcase_06 AC 579 ms
76,676 KB
testcase_07 AC 586 ms
76,928 KB
testcase_08 AC 70 ms
71,176 KB
testcase_09 AC 74 ms
75,804 KB
testcase_10 AC 68 ms
71,404 KB
testcase_11 AC 74 ms
76,304 KB
testcase_12 AC 77 ms
76,288 KB
testcase_13 AC 76 ms
76,240 KB
testcase_14 AC 73 ms
76,132 KB
testcase_15 AC 74 ms
76,092 KB
testcase_16 AC 70 ms
71,032 KB
testcase_17 AC 194 ms
76,888 KB
testcase_18 AC 80 ms
76,468 KB
testcase_19 AC 81 ms
76,520 KB
testcase_20 AC 68 ms
71,348 KB
testcase_21 AC 560 ms
76,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
from itertools import product
n,w = na()
a = na()
c = set()
for i in product(range(3), repeat  = n):
    s = 0
    d = 0
    for j in range(n):
        if i[j]>0:
            d+=1<<j
        if i[j]==1:
            s+=a[j]//2
        if i[j]==2:
            s+=a[j]
    if d==0:
        continue
    if s==w:
        c.add(d)

print(len(c))
0