結果
問題 | No.1701 half price |
ユーザー |
|
提出日時 | 2021-10-09 00:01:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 99,584 KB |
最終ジャッジ日時 | 2024-07-23 08:33:12 |
合計ジャッジ時間 | 3,118 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 WA * 4 |
ソースコード
N,W = map(int,input().split()) a = list(map(int,input().split())) ans = 0 score = 0 cnd_list = [] cnd = [] def dfs(x): global score,ans,cnd,cnd_list if score == W: cnd_list.append(tuple(cnd)) ans += 1 if x == N: return if score > W: return dfs(x+1) score += a[x]//2 cnd.append(x) dfs(x+1) cnd.remove(x) score -= a[x]//2 score += a[x] cnd.append(x) dfs(x+1) cnd.remove(x) score -= a[x] return dfs(0) print(len(set(cnd_list)))