結果

問題 No.482 あなたの名は
ユーザー GrayCoderGrayCoder
提出日時 2018-06-24 20:47:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 30,056 KB
最終ジャッジ日時 2023-09-13 13:46:41
合計ジャッジ時間 3,329 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,792 KB
testcase_01 AC 15 ms
7,848 KB
testcase_02 AC 15 ms
7,776 KB
testcase_03 AC 15 ms
7,724 KB
testcase_04 AC 17 ms
7,784 KB
testcase_05 WA -
testcase_06 AC 15 ms
7,768 KB
testcase_07 AC 16 ms
7,784 KB
testcase_08 AC 16 ms
7,852 KB
testcase_09 AC 16 ms
7,848 KB
testcase_10 AC 15 ms
7,768 KB
testcase_11 AC 16 ms
7,712 KB
testcase_12 AC 16 ms
7,720 KB
testcase_13 AC 16 ms
7,848 KB
testcase_14 AC 17 ms
7,776 KB
testcase_15 AC 106 ms
29,860 KB
testcase_16 AC 105 ms
29,932 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 108 ms
29,864 KB
testcase_20 WA -
testcase_21 AC 103 ms
29,836 KB
testcase_22 AC 103 ms
29,916 KB
testcase_23 WA -
testcase_24 AC 102 ms
29,856 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 101 ms
29,944 KB
testcase_28 WA -
testcase_29 AC 97 ms
29,944 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0