結果
| 問題 | No.10 +か×か |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-12-06 21:24:19 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 116 ms / 5,000 ms |
| + 975µs | |
| コード長 | 424 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 96,368 KB |
| 実行使用メモリ | 122,368 KB |
| 最終ジャッジ日時 | 2026-07-19 02:47:35 |
| 合計ジャッジ時間 | 2,847 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
n = int(input())
t = int(input())
*a, = map(int,input().split())
dp = [-1]*(t+1) # +: 1 *: 0
dp[a[0]] = 0
for ai in a[1:]:
ndp = [-1]*(t+1)
for i,xi in enumerate(dp):
if xi==-1: continue
if i*ai <= t:
ndp[i*ai] = max(ndp[i*ai], xi*2)
if i+ai <= t:
ndp[i+ai] = max(ndp[i+ai], xi*2+1)
dp = ndp
print("".join(["+" if dp[t]>>i&1 else "*" for i in range(n-2,-1,-1)]))
convexineq