結果
問題 | No.1701 half price |
ユーザー | mesame3993 |
提出日時 | 2021-10-08 23:04:54 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 901 ms |
コンパイル使用メモリ | 86,200 KB |
実行使用メモリ | 82,836 KB |
最終ジャッジ日時 | 2023-09-30 12:26:28 |
合計ジャッジ時間 | 5,600 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,020 KB |
testcase_01 | AC | 71 ms
71,016 KB |
testcase_02 | AC | 186 ms
78,780 KB |
testcase_03 | AC | 73 ms
71,232 KB |
testcase_04 | WA | - |
testcase_05 | AC | 87 ms
76,260 KB |
testcase_06 | AC | 819 ms
82,600 KB |
testcase_07 | WA | - |
testcase_08 | AC | 69 ms
71,172 KB |
testcase_09 | AC | 70 ms
71,100 KB |
testcase_10 | AC | 71 ms
71,164 KB |
testcase_11 | AC | 72 ms
71,144 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 72 ms
70,832 KB |
testcase_16 | AC | 72 ms
70,888 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 72 ms
71,196 KB |
testcase_21 | AC | 723 ms
82,836 KB |
ソースコード
from itertools import product n, w = map(int, input().split()) a = list(map(int, input().split())) if w == 0: print(a.count(0)) exit() b = [i // 2 for i in a] ans = 0 it = [] items = [i for i in range(n)] for bits in product([0, 1], repeat=n): tmp = [[x] for x, bit in zip(items, bits) if bit == 1] if tmp == []: continue it.append(tmp) for i in it: l = [] for j in range(len(i)): l.append([a[j], b[j]]) st = [] for k in product(*l): k = sorted(k) if sum(k) == w and k not in st: st.append(k) ans += 1 print(ans)