結果

問題 No.482 あなたの名は
ユーザー htkbhtkb
提出日時 2018-05-22 21:49:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 290 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 31,444 KB
最終ジャッジ日時 2023-09-11 01:22:28
合計ジャッジ時間 4,799 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 16 ms
7,984 KB
testcase_02 AC 16 ms
7,840 KB
testcase_03 AC 15 ms
7,904 KB
testcase_04 AC 15 ms
7,784 KB
testcase_05 AC 15 ms
7,920 KB
testcase_06 AC 15 ms
7,956 KB
testcase_07 AC 16 ms
7,756 KB
testcase_08 AC 15 ms
7,760 KB
testcase_09 AC 15 ms
7,880 KB
testcase_10 AC 15 ms
7,804 KB
testcase_11 AC 15 ms
7,812 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 131 ms
31,176 KB
testcase_17 AC 129 ms
31,248 KB
testcase_18 AC 130 ms
31,348 KB
testcase_19 WA -
testcase_20 AC 134 ms
31,240 KB
testcase_21 AC 130 ms
31,312 KB
testcase_22 WA -
testcase_23 AC 131 ms
31,344 KB
testcase_24 WA -
testcase_25 AC 131 ms
31,308 KB
testcase_26 WA -
testcase_27 AC 131 ms
31,180 KB
testcase_28 AC 131 ms
31,220 KB
testcase_29 AC 141 ms
31,420 KB
testcase_30 AC 15 ms
7,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
a = tuple(map(int, input().split()))
x = 0
pair = 0
for i, n in enumerate(a, start=1):
    if i == n:
        continue
    if a[n-1] == i:
        pair += 1
    else:
        x += 1
x = max(0, x-1) + pair//2
print("YES" if x <= K and (K-x)%2 == 0 else "NO")
0