結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-06-22 10:35:16 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 640 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 23,756 KB |
最終ジャッジ日時 | 2024-10-02 10:11:03 |
合計ジャッジ時間 | 3,407 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#import pdb; pdb.set_trace() import sys import math def main(): (n, k) = map(int, raw_input().split()) d = map(int, raw_input().split()) count = 0 j = 0 while j < n: tmpd = d[j] if tmpd - 1 != j: tmpe = d[tmpd - 1] d[tmpd - 1] = tmpd d[j] = tmpe count += 1 else: j += 1 if k > count: if (k - count) % 2 == 0: print "YES" else: print "NO" elif k == count: print "YES" else: print "NO" if __name__ == '__main__': main()