結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-08 23:59:54 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 586 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-23 08:32:06 |
| 合計ジャッジ時間 | 2,601 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 3 |
ソースコード
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
return
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)))