結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-09-13 22:50:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 479 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,468 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-12-14 06:52:03 |
| 合計ジャッジ時間 | 2,536 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
n=int(input())
a=list(map(int,input().split()))
dp=[[a[0],a[0]] for i in range(n)]
for i in range(n-1):
t=[]
t.append(dp[i][0] - a[i+1])
t.append(dp[i][1] - a[i+1])
t.append(dp[i][0] + a[i+1])
t.append(dp[i][1] + a[i+1])
t.append(dp[i][0] * a[i+1])
t.append(dp[i][1] * a[i+1])
if a[i+1] !=0:
t.append(-(-dp[i][0] // a[i+1]))
t.append(-(-dp[i][1] // a[i+1]))
t.sort()
dp[i+1][0]=t[0]
dp[i+1][1]=t[-1]
print(dp[-1][1])
lllllll88938494