結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2017-02-11 16:56:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 342 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 29,560 KB |
最終ジャッジ日時 | 2024-12-29 16:30:02 |
合計ジャッジ時間 | 5,356 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 11 |
ソースコード
n,k=map(int,input().split()) d=list(map(lambda x: x-1, map(int,input().split()))) dif=False cnt=0 for i in range(n): j = d[i] if d[i] != j and d[j] != i: dif = True if i == j: continue cnt+=1 d[j] = d[i] if dif and k > cnt: print("YES") else: print("YES" if cnt == k or (k>cnt and (k-cnt)&1==0) else "NO")