結果

問題 No.482 あなたの名は
ユーザー pluto77
提出日時 2017-02-14 09:20:12
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 278 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 30,564 KB
最終ジャッジ日時 2024-12-29 21:07:34
合計ジャッジ時間 47,209 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_482

n,k=map(int,raw_input().split())
d=map(int,raw_input().split())
for i in xrange(n):
 d[i]=d[i]-1
cnt=0
for i in xrange(n):
 if d[i]!=i:
  temp=d.index(i)
  d[i],d[temp]=d[temp],d[i]
  cnt+=1
 if cnt>k:
  break
if k>=cnt and k%2==cnt%2:
 print 'YES'
else:
 print 'NO'
0