結果
問題 | No.45 回転寿司 |
ユーザー |
|
提出日時 | 2023-10-06 12:54:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 507 bytes |
コンパイル時間 | 268 ms |
コンパイル使用メモリ | 82,604 KB |
実行使用メモリ | 76,696 KB |
最終ジャッジ日時 | 2024-07-26 15:22:58 |
合計ジャッジ時間 | 2,802 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 WA * 27 |
ソースコード
N = int(input()) V = list(map(int, input().split())) ans = 0 while len(V) > V.count(0): if len(V) < 3: ans += max(V) break a = [] for i in range(len(V)-2): a.append(V[i] + V[i+2]) t = a.index(max(a)) c0 = V[t] c1 = V[t+2] if c0 > c1: ans += c0 if t > 0: V[t-1] = 0 V[t] = 0 V[t+1] = 0 else: ans += c1 if t+3 < len(V): V[t+3] = 0 V[t+2] = 0 V[t+1] = 0 print(ans)