結果
問題 | No.999 てん vs. ほむ |
ユーザー | 双六 |
提出日時 | 2020-07-21 23:25:54 |
言語 | PyPy3 (7.3.13) |
結果 |
WA
|
実行時間 | - |
コード長 | 652 bytes |
コンパイル時間 | 631 ms |
コンパイル使用メモリ | 86,976 KB |
実行使用メモリ | 108,932 KB |
最終ジャッジ日時 | 2023-08-30 05:12:16 |
合計ジャッジ時間 | 5,682 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
71,492 KB |
testcase_01 | AC | 95 ms
71,756 KB |
testcase_02 | AC | 93 ms
71,476 KB |
testcase_03 | AC | 95 ms
71,692 KB |
testcase_04 | AC | 94 ms
71,376 KB |
testcase_05 | WA | - |
testcase_06 | AC | 95 ms
71,672 KB |
testcase_07 | AC | 94 ms
71,508 KB |
testcase_08 | AC | 104 ms
77,460 KB |
testcase_09 | AC | 142 ms
104,984 KB |
testcase_10 | AC | 112 ms
84,248 KB |
testcase_11 | AC | 108 ms
81,636 KB |
testcase_12 | AC | 114 ms
87,912 KB |
testcase_13 | AC | 140 ms
108,780 KB |
testcase_14 | AC | 137 ms
108,728 KB |
testcase_15 | AC | 139 ms
108,468 KB |
testcase_16 | AC | 140 ms
108,932 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 140 ms
108,528 KB |
testcase_22 | AC | 139 ms
108,612 KB |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N = int(input()) A = getlist() Lsum = [0] * N Rsum = [0] * N Lsum[0] = A[0] - A[1] Rsum[-1] = A[-1] - A[-2] for i in range(1, N): Lsum[i] = Lsum[i - 1] + A[2 * i] - A[2 * i + 1] Rsum[-1 - i] = Rsum[-i] + A[-1 - 2 * i] - A[-2 - 2 * i] if N == 1: print(abs(A[0] - A[1])) return ans = -INF for i in range(N - 1): ans = max(ans, Lsum[i] + Rsum[i + 1]) print(ans) if __name__ == '__main__': main()