結果
| 問題 | No.1701 half price |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-06-09 02:51:34 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 271 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 80,768 KB |
| 最終ジャッジ日時 | 2026-06-09 02:51:38 |
| 合計ジャッジ時間 | 3,161 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 WA * 4 |
ソースコード
from itertools import product
N, W = map(int, input().split())
A = list(map(int, input().split()))
used = set()
for xs in product([0, 1, 2], repeat=N):
tot = 0
b = 0
for i, x in enumerate(xs):
match x:
case 0:
b <<= 1
case 1:
tot += A[i]
b = (b << 1) | 1
case 2:
tot += A[i] // 2
b = (b << 1) | 1
if tot == W:
used.add(b)
ans = len(used)
print(ans)
norioc