結果

問題 No.482 あなたの名は
ユーザー TatsunoTatsuno
提出日時 2017-02-11 17:38:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 30,016 KB
最終ジャッジ日時 2023-08-28 14:44:28
合計ジャッジ時間 3,890 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,840 KB
testcase_01 AC 15 ms
7,908 KB
testcase_02 AC 16 ms
7,940 KB
testcase_03 AC 15 ms
7,828 KB
testcase_04 AC 15 ms
7,772 KB
testcase_05 WA -
testcase_06 AC 14 ms
7,692 KB
testcase_07 WA -
testcase_08 AC 15 ms
7,808 KB
testcase_09 AC 15 ms
7,776 KB
testcase_10 AC 15 ms
7,960 KB
testcase_11 AC 16 ms
7,940 KB
testcase_12 AC 15 ms
7,752 KB
testcase_13 WA -
testcase_14 AC 15 ms
7,772 KB
testcase_15 AC 149 ms
29,900 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 146 ms
29,840 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 147 ms
29,828 KB
testcase_23 WA -
testcase_24 AC 144 ms
29,824 KB
testcase_25 WA -
testcase_26 AC 143 ms
29,848 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 152 ms
29,996 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt=0
for i in range(n):
    if d[i] == i: continue
    if d[d[i]] == i:
        cnt+=1
        d[d[i]] = d[i]
        d[i] = i
    else:
        cnt+=1

print("YES" if k>=cnt and k&1==cnt&1 else "NO")
0