結果

問題 No.1687 What the Heck?
ユーザー TomoyarnTomoyarn
提出日時 2022-01-01 21:33:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 456 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 85,376 KB
最終ジャッジ日時 2024-04-18 21:42:54
合計ジャッジ時間 7,613 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
56,960 KB
testcase_01 AC 40 ms
51,712 KB
testcase_02 AC 40 ms
51,584 KB
testcase_03 AC 40 ms
51,840 KB
testcase_04 AC 42 ms
51,840 KB
testcase_05 AC 40 ms
51,840 KB
testcase_06 AC 41 ms
51,968 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

#初項 a,公差 1,末項 l
l = N
a = 1

wa =  (l - a + 1) * (a + l) // 2

A = list(map(int, input().split()))
idx = A.index(N) + 1

takeda = wa - idx
suzuki = idx

ans = max(takeda - suzuki, 0)
#print(N, ans)

for i in range(N - 1, 0, -1):
    idx = A.index(i) + 1
    takeda -= idx
    suzuki = idx
    #print(i, takeda, suzuki, takeda - suzuki)
    if max(takeda - suzuki, 0) > ans:
        ans = max(takeda - suzuki, 0)
print(ans)
0