結果

問題 No.482 あなたの名は
ユーザー 1235486527
提出日時 2019-12-15 07:31:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 29,420 KB
最終ジャッジ日時 2024-06-28 17:04:56
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
D = [0]
D.extend(list(map(int, input().split())))
for i in range(1, N+1):
    while D[i] != i:
        temp = D[i]
        D[i], D[temp] = D[temp], D[i]
        K -= 1
    if K < 0:
        break
if K & 1 == 1 or K < 0:
    print('NO')
else:
    print('YES')
0