結果

問題 No.482 あなたの名は
ユーザー matsu7874
提出日時 2017-02-10 22:53:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,540 KB
最終ジャッジ日時 2024-12-29 20:19:14
合計ジャッジ時間 4,824 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int, input().split())
d = list(map(lambda x: int(x)-1, input().split()))

for i in range(n):
    while d[i] != i:
        k -= 1
        t = d[i]
        d[i], d[t] = d[t], t
if k>=0 and k%2 == 0:
    print('YES')
else:
    print('NO')
0