結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー yuusanlondon
提出日時 2021-03-12 21:48:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,024 KB
実行使用メモリ 117,404 KB
最終ジャッジ日時 2024-10-14 12:09:19
合計ジャッジ時間 9,688 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  b.append((a[i],i))
b.sort()
ans=0
pointer=0
for i in range(n-2,-1,-1):
  if b[i][1]+1!=b[i+1][1]:
    if b[i+1][1]==pointer:
      pointer+=1
    else:
      ans+=1
print(ans)
0