結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
player
|
| 提出日時 | 2024-01-16 02:51:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,879 ms / 3,000 ms |
| コード長 | 484 bytes |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 339,848 KB |
| 最終ジャッジ日時 | 2024-09-28 02:26:27 |
| 合計ジャッジ時間 | 8,287 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
from itertools import *
n, w = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
sequences = list(product([0, 0.5, 1], repeat=n))
used = set()
for seq in sequences:
seq = list(seq)
lis = []
cost = 0
for i in range(n):
if seq[i] != 0:
lis.append(i)
cost += int(seq[i] * a[i])
tup = tuple(lis)
if tup in used:
continue
if cost == w and len(lis) > 0:
ans += 1
used.add(tup)
print(ans)
player