結果
問題 | No.999 てん vs. ほむ |
ユーザー | tktk_snsn |
提出日時 | 2021-04-28 01:20:17 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 295 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 10,680 KB |
実行使用メモリ | 31,068 KB |
最終ジャッジ日時 | 2023-09-21 01:56:13 |
合計ジャッジ時間 | 3,936 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,460 KB |
testcase_01 | AC | 18 ms
8,572 KB |
testcase_02 | AC | 19 ms
8,496 KB |
testcase_03 | AC | 18 ms
8,588 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 19 ms
8,652 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 | 137 ms
29,932 KB |
testcase_18 | AC | 137 ms
29,756 KB |
testcase_19 | AC | 138 ms
29,936 KB |
testcase_20 | AC | 142 ms
30,156 KB |
testcase_21 | AC | 142 ms
30,288 KB |
testcase_22 | AC | 134 ms
29,588 KB |
ソースコード
from collections import deque N = int(input()) A = tuple(map(int, input().split())) ans = 0 head = 0 tail = 2*N-1 while tail > head: x = A[head] - A[head+1] y = A[tail] - A[tail-1] if x > y: ans += x head += 2 else: ans += y tail -= 2 print(ans)