結果
問題 | No.999 てん vs. ほむ |
ユーザー |
![]() |
提出日時 | 2020-07-21 23:13:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 105,532 KB |
最終ジャッジ日時 | 2024-12-31 13:33:27 |
合計ジャッジ時間 | 3,476 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 12 |
ソースコード
import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() A=LI() l=0 r=2*N-1 ans=0 for i in range(N): a=A[l]-A[l+1] b=A[r]-A[r-1] if a>b: ans+=a l+=2 else: ans+=b r-=2 print(ans) main()