結果
| 問題 | No.1701 half price |
| コンテスト | |
| ユーザー |
player
|
| 提出日時 | 2024-01-16 02:51:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,276 ms / 3,000 ms |
| コード長 | 484 bytes |
| 記録 | |
| コンパイル時間 | 364 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 367,208 KB |
| 最終ジャッジ日時 | 2026-04-14 19:30:00 |
| 合計ジャッジ時間 | 6,508 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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