結果
問題 |
No.999 てん vs. ほむ
|
ユーザー |
![]() |
提出日時 | 2020-03-02 21:15:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 537 ms / 2,000 ms |
コード長 | 516 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 53,752 KB |
最終ジャッジ日時 | 2024-10-13 21:17:51 |
合計ジャッジ時間 | 14,428 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% import numpy as np # %% N = int(readline()) A = np.array(read().split(), np.int64) # %% from_left = np.zeros(N + 1, np.int64) from_left[1:] = (A[::2] - A[1::2]).cumsum() # %% from_right = np.zeros(N + 1, np.int64) from_right[1:] = (A[::-1][::2] - A[::-1][1::2]).cumsum() from_right = from_right[::-1] # %% answer = (from_left + from_right).max() print(answer)