結果
問題 | No.482 あなたの名は |
ユーザー |
|
提出日時 | 2018-06-24 20:47:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 29,696 KB |
最終ジャッジ日時 | 2024-06-30 22:34:51 |
合計ジャッジ時間 | 3,861 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 9 |
ソースコード
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())) diff = 0 d = [0] + D i = 1 while 1: if d[i] != i: j = d[i] d[i], d[j] = d[j], d[i] diff += 1 else: i += 1 if i > N: break if diff > K: write('NO\n') return ope = -(-diff // 2) if K >= ope and not (K - ope) % 2: write('YES\n') else: write('NO\n') main()