結果

問題 No.999 てん vs. ほむ
ユーザー ronpooronpoo
提出日時 2023-09-27 16:07:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 103,360 KB
最終ジャッジ日時 2023-09-27 16:07:32
合計ジャッジ時間 4,611 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,252 KB
testcase_01 AC 64 ms
71,320 KB
testcase_02 AC 73 ms
71,356 KB
testcase_03 AC 62 ms
71,432 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 63 ms
71,292 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 98 ms
103,164 KB
testcase_18 AC 98 ms
102,972 KB
testcase_19 AC 100 ms
103,360 KB
testcase_20 AC 99 ms
103,144 KB
testcase_21 AC 112 ms
100,072 KB
testcase_22 AC 112 ms
100,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

ans = 0
l = 0
r = N*2 - 1
for _ in range(N):
    x = A[l] - A[l+1]
    y = A[r] - A[r-1]
    if x >= y:
        ans += x
        l += 2
    else:
        ans += y
        r -= 2
print(ans)
0