結果

問題 No.482 あなたの名は
ユーザー convexineq
提出日時 2021-02-14 23:01:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 280 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 111,336 KB
最終ジャッジ日時 2024-07-22 10:55:32
合計ジャッジ時間 3,966 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます

ソースコード

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