結果

問題 No.1687 What the Heck?
ユーザー raven7959raven7959
提出日時 2021-09-26 08:29:32
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 181 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 106,872 KB
最終ジャッジ日時 2023-09-19 02:49:09
合計ジャッジ時間 3,364 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,164 KB
testcase_01 AC 73 ms
71,088 KB
testcase_02 AC 73 ms
71,076 KB
testcase_03 AC 74 ms
71,156 KB
testcase_04 AC 73 ms
70,924 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 87 ms
84,524 KB
testcase_10 AC 84 ms
80,816 KB
testcase_11 AC 82 ms
81,136 KB
testcase_12 AC 113 ms
106,244 KB
testcase_13 AC 114 ms
106,040 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
P=list(map(int,input().split()))
for i in reversed(range(N)):
  if P[i]!=i+1:
    break
if i==0:
  print(0)
else:
  idx=P.index(i+1)
  print((i+1)*(i+2)//2-2*(idx+1))
0