結果

問題 No.482 あなたの名は
ユーザー Mr.FukuMr.Fuku
提出日時 2018-08-08 16:38:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 31,836 KB
最終ジャッジ日時 2023-10-24 10:59:36
合計ジャッジ時間 5,538 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,092 KB
testcase_01 AC 28 ms
10,092 KB
testcase_02 AC 29 ms
10,092 KB
testcase_03 AC 29 ms
10,092 KB
testcase_04 AC 28 ms
10,092 KB
testcase_05 AC 29 ms
10,092 KB
testcase_06 AC 28 ms
10,092 KB
testcase_07 AC 29 ms
10,180 KB
testcase_08 AC 29 ms
10,136 KB
testcase_09 AC 28 ms
10,096 KB
testcase_10 AC 67 ms
10,132 KB
testcase_11 AC 30 ms
10,156 KB
testcase_12 AC 30 ms
10,172 KB
testcase_13 AC 30 ms
10,132 KB
testcase_14 AC 29 ms
10,124 KB
testcase_15 AC 156 ms
31,836 KB
testcase_16 AC 160 ms
31,836 KB
testcase_17 AC 163 ms
31,836 KB
testcase_18 AC 162 ms
31,836 KB
testcase_19 AC 161 ms
31,836 KB
testcase_20 AC 163 ms
31,836 KB
testcase_21 AC 163 ms
31,836 KB
testcase_22 AC 160 ms
31,836 KB
testcase_23 AC 157 ms
31,836 KB
testcase_24 AC 164 ms
31,836 KB
testcase_25 AC 157 ms
31,836 KB
testcase_26 AC 158 ms
31,836 KB
testcase_27 AC 155 ms
31,836 KB
testcase_28 AC 155 ms
31,836 KB
testcase_29 AC 143 ms
31,836 KB
testcase_30 AC 28 ms
10,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
lst = [0]+list(map(int,input().split()))

cnt = 0
def change(i,x):
    global cnt
    lst[i] = lst[x]
    lst[x] = x
    cnt+=1
    if i!=lst[i]:
        change(i,lst[i])

for i in range(N+1):
    x = lst[i]
    if x!=i:
        change(i,x)

print("NO" if cnt>K or (K-cnt)%2 else "YES")
0