結果

問題 No.482 あなたの名は
ユーザー GrayCoder
提出日時 2018-06-24 20:24:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,428 KB
最終ジャッジ日時 2024-06-30 22:34:39
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, K = map(int, input().split())
    D = tuple(map(int, input().split()))

    diff = 0
    for i, d in enumerate(D, start=1):
        if i != d:
            diff += 1

    ope = max(0, diff - 1)
    if K >= ope and not (K - ope) % 2:
        write('YES\n')
    else:
        write('NO\n')

main()
0