結果
| 問題 |
No.2889 Rusk
|
| コンテスト | |
| ユーザー |
yupooh
|
| 提出日時 | 2024-09-13 22:14:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 222 ms / 2,000 ms |
| コード長 | 799 bytes |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 132,564 KB |
| 最終ジャッジ日時 | 2024-09-13 22:15:07 |
| 合計ジャッジ時間 | 8,949 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 52 |
ソースコード
import sys input = sys.stdin.readline n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) dp=[-10**20]*5 dp[0]=a[0] dp[1]=b[0] for i in range(1,n): dp[4]+=a[i] dp[4]=max(dp[4],dp[3]+a[i]) dp[3]+=b[i] dp[3]=max(dp[3],dp[2]+b[i]) dp[2]+=a[i] dp[2]=max(dp[2],dp[1]+a[i]) dp[1]+=b[i] dp[1]=max(dp[1],dp[0]+b[i]) dp[0]+=a[i] ans=max(dp) dp=[-10**20]*5 dp[0]=a[0] dp[1]=b[0] dp[2]=c[0] for i in range(1,n): dp[4]+=a[i] dp[4]=max(dp[4],dp[3]+a[i]) dp[4]=max(dp[4],dp[2]+a[i]) dp[3]+=b[i] dp[3]=max(dp[3],dp[2]+b[i]) dp[2]+=c[i] dp[2]=max(dp[2],dp[1]+c[i]) dp[2]=max(dp[2],dp[0]+c[i]) dp[1]+=b[i] dp[1]=max(dp[1],dp[0]+b[i]) dp[0]+=a[i] ans=max(ans,dp[2]) ans=max(ans,dp[3]) ans=max(ans,dp[4]) print(ans)
yupooh