結果

問題 No.482 あなたの名は
ユーザー TatsunoTatsuno
提出日時 2017-02-11 17:49:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 30,056 KB
最終ジャッジ日時 2023-08-28 16:21:33
合計ジャッジ時間 4,288 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,804 KB
testcase_01 AC 14 ms
7,940 KB
testcase_02 AC 14 ms
7,792 KB
testcase_03 AC 14 ms
7,840 KB
testcase_04 AC 14 ms
7,796 KB
testcase_05 AC 14 ms
7,828 KB
testcase_06 AC 14 ms
7,832 KB
testcase_07 AC 14 ms
7,904 KB
testcase_08 AC 14 ms
7,804 KB
testcase_09 AC 14 ms
7,832 KB
testcase_10 AC 15 ms
7,832 KB
testcase_11 AC 15 ms
7,800 KB
testcase_12 AC 14 ms
7,832 KB
testcase_13 AC 14 ms
7,884 KB
testcase_14 AC 15 ms
7,804 KB
testcase_15 AC 176 ms
29,964 KB
testcase_16 AC 175 ms
30,040 KB
testcase_17 AC 177 ms
29,952 KB
testcase_18 AC 179 ms
30,008 KB
testcase_19 AC 186 ms
29,884 KB
testcase_20 AC 184 ms
29,852 KB
testcase_21 AC 179 ms
30,000 KB
testcase_22 AC 187 ms
29,860 KB
testcase_23 AC 181 ms
29,972 KB
testcase_24 AC 179 ms
29,912 KB
testcase_25 AC 179 ms
30,036 KB
testcase_26 AC 178 ms
30,056 KB
testcase_27 AC 179 ms
29,916 KB
testcase_28 AC 179 ms
29,972 KB
testcase_29 AC 180 ms
29,916 KB
testcase_30 AC 15 ms
7,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
d=list(map(lambda x: x-1, map(int,input().split())))
e=[0]*n
for i in range(n):
    e[d[i]] = i

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

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