結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2017-08-17 20:15:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 189 ms / 2,000 ms |
コード長 | 541 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 29,548 KB |
最終ジャッジ日時 | 2024-10-14 13:55:29 |
合計ジャッジ時間 | 4,600 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
# -*- coding: utf-8 -*- ''' 行列式を思い出せる問題 http://mathtrain.jp/permutation O(N)の置換の実装がすべて(行きがかりのiをしかるべきものに交換してやらないといけない) ''' N,K = map(int, input().split()) D = list(map(int, input().split())) E = [0] for d in D: E.append(d) total = 0 for i in range(1, N+1): while E[i] != i: temp = E[i] E[i] = E[temp] E[temp] = temp total += 1 if total<=K and (K-total)%2==0: print('YES') else: print('NO')