結果
| 問題 | No.10 +か×か |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-08 19:18:22 |
| 言語 | Python3 (3.14.2 + numpy 2.4.0 + scipy 1.16.3) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 5,000 ms |
| コード長 | 442 bytes |
| 記録 | |
| コンパイル時間 | 107 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2025-12-06 15:05:26 |
| 合計ジャッジ時間 | 1,201 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
import sys
read = sys.stdin.buffer.read
N,T,*A=map(int,read().split())
dp=[set() for _ in range(N+1)]
dp[N].add(T)
for n in range(N,0,-1):
x=A[n-1]
for y in dp[n]:
if y-x>=0: dp[n-1].add(y-x)
if y%x==0: dp[n-1].add(y//x)
assert 0 in dp[0]
ans=[]
x=0
for n in range(1,N+1):
y=A[n-1]
if x+y in dp[n]:
ans.append('+')
x+=y
else:
ans.append('*')
x *= y
print(''.join(ans[1:]))