結果
問題 |
No.2673 A present from B
|
ユーザー |
|
提出日時 | 2024-03-15 22:57:17 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 437 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 53,248 KB |
最終ジャッジ日時 | 2024-09-30 02:30:31 |
合計ジャッジ時間 | 2,366 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 6 WA * 18 |
ソースコード
n,m=map(int,input().split()) L=list(map(lambda x:x-1,map(int,input().split()))) P=[i for i in range(n)] for e in L: P[e],P[e+1]=P[e+1],P[e] M=P[:] P2=[i for i in range(n)] for e in L: P2[e],P2[e+1]=P2[e+1],P2[e] M[P2[e]]=min( M[P2[e]] , e ) M[P2[e+1]]=min( M[P2[e+1]] , e+1) ans=[1000]*(n) for i in range(1,n): if P[0]==i: ans[i]=0 else: if M[i]==0: ans[i]=1 else: ans[i]=M[i] print(*ans[1:])