結果

問題 No.482 あなたの名は
ユーザー convexineqconvexineq
提出日時 2021-02-14 23:02:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 108,156 KB
最終ジャッジ日時 2023-09-29 16:51:50
合計ジャッジ時間 5,436 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,164 KB
testcase_01 AC 74 ms
71,348 KB
testcase_02 AC 71 ms
71,452 KB
testcase_03 AC 73 ms
71,256 KB
testcase_04 AC 71 ms
71,168 KB
testcase_05 AC 70 ms
71,156 KB
testcase_06 AC 70 ms
70,972 KB
testcase_07 AC 70 ms
71,284 KB
testcase_08 AC 70 ms
71,336 KB
testcase_09 AC 70 ms
71,328 KB
testcase_10 AC 71 ms
71,328 KB
testcase_11 AC 71 ms
71,340 KB
testcase_12 AC 71 ms
71,072 KB
testcase_13 AC 71 ms
71,072 KB
testcase_14 AC 71 ms
71,232 KB
testcase_15 AC 140 ms
108,024 KB
testcase_16 AC 137 ms
108,056 KB
testcase_17 AC 140 ms
107,904 KB
testcase_18 AC 137 ms
108,052 KB
testcase_19 AC 141 ms
108,028 KB
testcase_20 AC 138 ms
108,048 KB
testcase_21 AC 141 ms
107,776 KB
testcase_22 AC 138 ms
108,028 KB
testcase_23 AC 139 ms
107,888 KB
testcase_24 AC 141 ms
108,104 KB
testcase_25 AC 136 ms
108,052 KB
testcase_26 AC 137 ms
108,104 KB
testcase_27 AC 136 ms
108,052 KB
testcase_28 AC 138 ms
107,856 KB
testcase_29 AC 130 ms
108,156 KB
testcase_30 AC 72 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
*a, = map(int,input().split())
for i in range(n):
    a[i] -= 1
c = 0
for i in range(n):
    if a[i] < 0: continue
    c += 1
    while a[i] >= 0:
        ni = a[i]
        a[i] = -1
        i = ni
print("YES" if k >= n-c and (k-n+c)%2==0 else "NO")
0