結果

問題 No.3091 The Little Match Boy
ユーザー Ruseu29
提出日時 2025-04-06 15:43:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 24,660 KB
最終ジャッジ日時 2025-04-06 15:43:33
合計ジャッジ時間 7,927 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
A = list(map(int,input().split()))
sample = [n for n in range(N+1)]
tmp = set()
for k in range(K):
    i = A[k]
    tmp.add((min(sample[i],sample[i+1]),max(sample[i],sample[i+1])))
    sample[i],sample[i+1]  = sample[i+1],sample[i]
print(len(tmp))

0