結果

問題 No.3091 The Little Match Boy
ユーザー ゼット
提出日時 2025-04-06 16:32:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 81,940 KB
実行使用メモリ 94,776 KB
最終ジャッジ日時 2025-04-06 16:32:33
合計ジャッジ時間 5,919 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
D=set()
P=[i for i in range(N)]
for i in range(M):
  pos=A[i]-1
  a,b=P[pos],P[pos+1]
  if a>b:
    a,b=b,a
  w=a*10**10+b
  D.add(w)
  P[pos],P[pos+1]=P[pos+1],P[pos]
print(len(D))
0