結果

問題 No.482 あなたの名は
ユーザー JunOnumaJunOnuma
提出日時 2017-05-24 11:05:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 7,116 KB
実行使用メモリ 23,652 KB
最終ジャッジ日時 2023-10-19 19:55:37
合計ジャッジ時間 5,373 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,384 KB
testcase_01 AC 11 ms
6,384 KB
testcase_02 AC 11 ms
6,384 KB
testcase_03 AC 11 ms
6,384 KB
testcase_04 AC 11 ms
6,384 KB
testcase_05 AC 12 ms
6,384 KB
testcase_06 AC 11 ms
6,384 KB
testcase_07 AC 12 ms
6,428 KB
testcase_08 AC 11 ms
6,408 KB
testcase_09 AC 12 ms
6,384 KB
testcase_10 AC 11 ms
6,404 KB
testcase_11 AC 12 ms
6,412 KB
testcase_12 AC 12 ms
6,420 KB
testcase_13 AC 11 ms
6,404 KB
testcase_14 AC 11 ms
6,400 KB
testcase_15 AC 169 ms
23,652 KB
testcase_16 AC 167 ms
23,652 KB
testcase_17 AC 168 ms
23,652 KB
testcase_18 AC 168 ms
23,652 KB
testcase_19 AC 167 ms
23,652 KB
testcase_20 AC 166 ms
23,652 KB
testcase_21 AC 167 ms
23,652 KB
testcase_22 AC 167 ms
23,652 KB
testcase_23 AC 167 ms
23,652 KB
testcase_24 AC 167 ms
23,652 KB
testcase_25 AC 170 ms
23,652 KB
testcase_26 AC 169 ms
23,652 KB
testcase_27 AC 168 ms
23,652 KB
testcase_28 AC 168 ms
23,652 KB
testcase_29 AC 178 ms
23,652 KB
testcase_30 AC 11 ms
6,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int, raw_input().split())
l = map(int, raw_input().split())
for i,j in enumerate(l):
    if j == i+1:
        continue
    p = j
    while p != i+1:
        t = l[p-1]
        l[p-1] = p
        p = t
        k -= 1
    l[i] = p
if k >= 0 and k % 2 == 0:
    print 'YES'
else:
    print 'NO'
0