結果
問題 | No.1077 Noelちゃんと星々4 |
ユーザー | ああいい |
提出日時 | 2022-02-23 14:29:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 559 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 87,320 KB |
実行使用メモリ | 71,700 KB |
最終ジャッジ日時 | 2023-09-14 06:41:44 |
合計ジャッジ時間 | 3,378 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,336 KB |
testcase_01 | AC | 69 ms
71,264 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
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 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 68 ms
71,260 KB |
testcase_21 | WA | - |
ソースコード
N = int(input()) Y = list(map(int,input().split())) import sys if N == 1: print(0) exit() A = [Y[i+1] - Y[i] for i in range(N-1)] ans = 0 if A[0] < 0: ans += -A[0] A[0] = 0 for i in range(1,len(A)): if A[i] >= 0: continue if A[i-1] > 0: if A[i] + A[i-1] >= 0: ans += -A[i] A[i] = 0 continue else: ans += A[i-1] A[i] += A[i-1] if i == len(A)-1: ans += -A[i] else: ans += -A[i] A[i+1] += A[i] A[i] = 0 print(ans)