結果

問題 No.482 あなたの名は
ユーザー h_nosonh_noson
提出日時 2017-06-13 22:05:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 11,808 KB
実行使用メモリ 31,800 KB
最終ジャッジ日時 2023-10-24 21:53:05
合計ジャッジ時間 5,410 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,056 KB
testcase_01 AC 27 ms
10,056 KB
testcase_02 AC 27 ms
10,056 KB
testcase_03 AC 27 ms
10,056 KB
testcase_04 AC 27 ms
10,056 KB
testcase_05 AC 28 ms
10,056 KB
testcase_06 AC 28 ms
10,056 KB
testcase_07 AC 28 ms
10,148 KB
testcase_08 AC 29 ms
10,104 KB
testcase_09 AC 28 ms
10,064 KB
testcase_10 AC 28 ms
10,100 KB
testcase_11 AC 29 ms
10,132 KB
testcase_12 AC 28 ms
10,144 KB
testcase_13 AC 29 ms
10,100 KB
testcase_14 AC 27 ms
10,096 KB
testcase_15 AC 229 ms
31,800 KB
testcase_16 AC 221 ms
31,800 KB
testcase_17 AC 213 ms
31,800 KB
testcase_18 AC 222 ms
31,800 KB
testcase_19 AC 217 ms
31,800 KB
testcase_20 AC 217 ms
31,800 KB
testcase_21 AC 214 ms
31,800 KB
testcase_22 AC 217 ms
31,800 KB
testcase_23 AC 217 ms
31,800 KB
testcase_24 AC 219 ms
31,800 KB
testcase_25 AC 219 ms
31,800 KB
testcase_26 AC 225 ms
31,800 KB
testcase_27 AC 224 ms
31,800 KB
testcase_28 AC 226 ms
31,800 KB
testcase_29 AC 203 ms
31,800 KB
testcase_30 AC 27 ms
10,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split(' '))
d = list(map(lambda x:int(x)-1,input().split(' ')))
pos = [0] * n

for i in range(n):
    pos[d[i]] = i
for i in range(n):
    if d[i] != i:
        pos[d[i]] = pos[i]
        d[i],d[pos[i]] = d[pos[i]],d[i]
        k -= 1
if k >= 0 and k % 2 == 0:
    print("YES")
else:
    print("NO")
0