結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2018-08-08 16:40:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 171 ms / 2,000 ms |
コード長 | 367 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 29,568 KB |
最終ジャッジ日時 | 2024-09-23 03:20:15 |
合計ジャッジ時間 | 4,323 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
N,K = map(int,input().split()) lst = [0]+list(map(int,input().split())) cnt = 0 def change(i,x): global cnt lst[i] = lst[x] lst[x] = x cnt+=1 if cnt>K: print("NO") exit(0) if i!=lst[i]: change(i,lst[i]) for i in range(N+1): x = lst[i] if x!=i: change(i,x) print("NO" if cnt>K or (K-cnt)%2 else "YES")