結果

問題 No.482 あなたの名は
ユーザー yomo3yomo3
提出日時 2020-04-06 00:14:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 10,596 KB
実行使用メモリ 29,932 KB
最終ジャッジ日時 2023-09-18 00:41:41
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,752 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 15 ms
7,832 KB
testcase_03 AC 15 ms
7,780 KB
testcase_04 AC 15 ms
7,784 KB
testcase_05 AC 16 ms
7,808 KB
testcase_06 AC 15 ms
7,760 KB
testcase_07 AC 16 ms
7,716 KB
testcase_08 AC 16 ms
7,760 KB
testcase_09 AC 15 ms
7,840 KB
testcase_10 AC 16 ms
7,712 KB
testcase_11 AC 15 ms
7,768 KB
testcase_12 AC 16 ms
7,728 KB
testcase_13 AC 16 ms
7,716 KB
testcase_14 AC 16 ms
7,772 KB
testcase_15 AC 127 ms
29,904 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 126 ms
29,780 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 128 ms
29,888 KB
testcase_27 AC 128 ms
29,780 KB
testcase_28 AC 125 ms
29,908 KB
testcase_29 AC 144 ms
29,900 KB
testcase_30 AC 15 ms
7,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
D = [0] + list(map(int, input().split()))

done = [0] * (N + 1)
cnt = 0
for i in range(1, N+1):
    if D[i] == i: continue
    if not done[D[i]] or not done[i]:
        cnt += 1
        done[D[i]] = done[i] = True
yes = cnt <= K and cnt % 2 == K % 2
print('YES' if yes else 'NO')
0