結果
問題 |
No.1701 half price
|
ユーザー |
![]() |
提出日時 | 2022-12-31 19:34:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 373 ms / 3,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 75,776 KB |
最終ジャッジ日時 | 2024-11-26 18:47:12 |
合計ジャッジ時間 | 2,723 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
N, W = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for i in range(1, 1 << N): flag = 0 cnt = 0 for j in range(N): if (i >> j) & 1: cnt += A[j] if cnt == W: flag = 1 sub = i while sub: temp = W for j in range(N): if (sub >> j) & 1: temp += A[j]//2 if cnt == temp: flag = 1 sub = i & (sub - 1) ans += flag print(ans)