結果

問題 No.482 あなたの名は
ユーザー mlihua09mlihua09
提出日時 2020-09-04 14:10:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 109,064 KB
最終ジャッジ日時 2023-08-16 19:46:40
合計ジャッジ時間 6,003 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,268 KB
testcase_01 AC 67 ms
71,296 KB
testcase_02 AC 67 ms
71,284 KB
testcase_03 AC 65 ms
71,344 KB
testcase_04 AC 63 ms
71,020 KB
testcase_05 AC 69 ms
71,392 KB
testcase_06 AC 66 ms
71,420 KB
testcase_07 AC 65 ms
71,280 KB
testcase_08 AC 65 ms
71,284 KB
testcase_09 AC 70 ms
71,228 KB
testcase_10 AC 67 ms
71,360 KB
testcase_11 AC 67 ms
71,016 KB
testcase_12 AC 69 ms
71,396 KB
testcase_13 AC 65 ms
71,256 KB
testcase_14 AC 68 ms
71,296 KB
testcase_15 AC 118 ms
109,064 KB
testcase_16 AC 114 ms
108,960 KB
testcase_17 AC 116 ms
108,904 KB
testcase_18 AC 115 ms
108,792 KB
testcase_19 AC 113 ms
108,888 KB
testcase_20 AC 114 ms
109,020 KB
testcase_21 AC 113 ms
108,984 KB
testcase_22 AC 114 ms
108,956 KB
testcase_23 AC 114 ms
108,996 KB
testcase_24 AC 114 ms
109,032 KB
testcase_25 AC 117 ms
108,876 KB
testcase_26 AC 116 ms
109,064 KB
testcase_27 AC 112 ms
108,924 KB
testcase_28 AC 116 ms
108,880 KB
testcase_29 AC 113 ms
108,968 KB
testcase_30 AC 65 ms
71,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N, K = map(int, input().split())

D = list(map(lambda x: int(x) - 1, input().split()))

I = [0] * N

ans = 0
for i in range(N):
    I[D[i]] = i
    
for i in range(N):
    
    if D[i] != i:
        D[I[i]] = D[i]
        I[D[i]] = I[i]
        ans += 1
if ans <= K and (K - ans) % 2 == 0:
    print('YES')
else:
    print('NO')
0