結果

問題 No.1701 half price
ユーザー MasKoaTSMasKoaTS
提出日時 2021-10-31 17:37:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 631 ms / 3,000 ms
コード長 1,001 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 89,728 KB
最終ジャッジ日時 2024-04-17 11:09:01
合計ジャッジ時間 6,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
86,144 KB
testcase_01 AC 142 ms
87,040 KB
testcase_02 AC 185 ms
89,344 KB
testcase_03 AC 145 ms
87,168 KB
testcase_04 AC 193 ms
89,344 KB
testcase_05 AC 160 ms
89,216 KB
testcase_06 AC 631 ms
89,216 KB
testcase_07 AC 629 ms
89,344 KB
testcase_08 AC 140 ms
86,528 KB
testcase_09 AC 145 ms
87,040 KB
testcase_10 AC 139 ms
86,144 KB
testcase_11 AC 146 ms
86,912 KB
testcase_12 AC 147 ms
89,728 KB
testcase_13 AC 144 ms
87,168 KB
testcase_14 AC 145 ms
86,912 KB
testcase_15 AC 141 ms
87,296 KB
testcase_16 AC 140 ms
86,656 KB
testcase_17 AC 267 ms
89,472 KB
testcase_18 AC 159 ms
89,216 KB
testcase_19 AC 152 ms
89,728 KB
testcase_20 AC 138 ms
86,272 KB
testcase_21 AC 617 ms
89,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from copy import deepcopy as dcopy
import math
import sys
sys.setrecursionlimit(10**6)
def input():
    return sys.stdin.readline().rstrip()
def getN():
	return int(sys.stdin.readline().rstrip())
def getNs():
	return map(int,sys.stdin.readline().rstrip().split())
def getList():
	return list(map(int,sys.stdin.readline().rstrip().split()))
def strinps(n):
	return [sys.stdin.readline().rstrip() for _ in range(n)]
pi = 3.141592653589793
mod = 10**9+7
MOD = 998244353
INF = math.inf
dx = [1,0,-1,0];	dy = [0,1,0,-1]


"""
Main Code
"""

n,w = getNs()
a = getList()

l = [0,1,2]
st = set([])
for choice in iter.product(l,repeat = n):
	price = 0
	bit = 0
	for i in range(n):
		if(choice[i] != 0):
			bit |= 1 << i
		if(choice[i] == 1):
			price += a[i] // 2
		elif(choice[i] == 2):
			price += a[i]
	if(price == w):
		st.add(bit)
ans = len(st)
if(0 in st):
	ans -= 1
print(ans)
0