結果
問題 |
No.505 カードの数式2
|
ユーザー |
![]() |
提出日時 | 2022-09-13 22:34:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 82,064 KB |
実行使用メモリ | 53,748 KB |
最終ジャッジ日時 | 2024-12-14 06:39:22 |
合計ジャッジ時間 | 2,606 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 2 |
ソースコード
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])