結果
問題 |
No.10 +か×か
|
ユーザー |
|
提出日時 | 2023-06-07 21:31:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 837 bytes |
コンパイル時間 | 400 ms |
コンパイル使用メモリ | 82,148 KB |
実行使用メモリ | 109,964 KB |
最終ジャッジ日時 | 2024-12-30 03:23:40 |
合計ジャッジ時間 | 2,476 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 5 |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) T = int(input()) A = list(map(int,input().split())) dp = [[False]*(T+2) for _ in range(N)] a = A[0] dp[0][a]=3 for i in range(N-1): a = A[i+1] for j in range(T+1): if not dp[i][j]: continue dp[i+1][min(j+a,T+1)] = 1 for j in range(T+1): if not dp[i][j]: continue if dp[i+1][min(j*a,T+1)]==1: continue dp[i+1][min(j*a,T+1)] = 2 ans = [] now = T for i in range(N-1,0,-1): a = A[i] if dp[i][now]==1: ans.append('+') now -= a else: ans.append('*') now //= a ans.reverse() print(*ans,sep='')