結果

問題 No.2673 A present from B
ユーザー miho-4miho-4
提出日時 2024-03-15 22:57:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2024-03-15 22:57:29
合計ジャッジ時間 2,199 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 WA -
testcase_02 AC 36 ms
53,460 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 37 ms
53,460 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 38 ms
53,460 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 36 ms
53,460 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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:])
0