結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2021-10-10 01:20:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 507 ms / 3,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 81,504 KB |
| 実行使用メモリ | 75,928 KB |
| 最終ジャッジ日時 | 2024-09-13 15:41:59 |
| 合計ジャッジ時間 | 3,420 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
n, w = map(int, input().split())
a = list(map(int, input().split()))
if w == 0:
c = a.count(0)
print(2**c-1)
exit(0)
ans = set()
for bit in range(3**n):
x = bit
total = 0
key = 0
for i in range(n):
y = x % 3
x //= 3
if y == 1: total += a[i]
if y == 2: total += a[i] // 2
if y != 0: key |= (1 << i)
if total == w: ans.add(key)
print(len(ans))
neko_the_shadow