結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2018-06-24 20:51:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 139 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 29,564 KB |
最終ジャッジ日時 | 2024-06-30 22:34:56 |
合計ジャッジ時間 | 4,012 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N, K = map(int, input().split()) D = list(map(int, input().split())) ope = 0 d = [0] + D i = 1 while 1: if d[i] != i: j = d[i] d[i], d[j] = d[j], d[i] ope += 1 else: i += 1 if i > N: break if ope > K: write('NO\n') return if K >= ope and K % 2 == ope % 2: write('YES\n') else: write('NO\n') main()