結果

問題 No.482 あなたの名は
ユーザー けむけむけむけむ
提出日時 2021-09-12 15:22:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 30,080 KB
最終ジャッジ日時 2023-09-06 10:41:01
合計ジャッジ時間 5,333 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,784 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 16 ms
7,732 KB
testcase_04 AC 16 ms
7,828 KB
testcase_05 AC 16 ms
7,828 KB
testcase_06 AC 15 ms
7,776 KB
testcase_07 WA -
testcase_08 AC 16 ms
7,732 KB
testcase_09 AC 15 ms
7,792 KB
testcase_10 AC 16 ms
7,844 KB
testcase_11 AC 16 ms
7,804 KB
testcase_12 WA -
testcase_13 AC 16 ms
7,904 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 115 ms
30,008 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 118 ms
29,892 KB
testcase_20 AC 114 ms
29,876 KB
testcase_21 WA -
testcase_22 AC 117 ms
29,952 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 116 ms
29,912 KB
testcase_26 AC 116 ms
29,872 KB
testcase_27 WA -
testcase_28 AC 118 ms
30,020 KB
testcase_29 AC 100 ms
30,020 KB
testcase_30 AC 16 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def yourname(N, K, D):
    j = 0
    for i in range(N):
        d = D[j]
        if d == j + 1:
            j += 1
            if j > N - 1:
                break
            continue
        else:
            D[j], D[d - 1] = D[d - 1], D[j]
            K -= 1

    if K >= 0:
        if K % 2 == 0:
            return 'YES'
        else:
            return 'NO'
    else:
        return 'NO'

def main():
    N, K = map(int, input().split())
    D = list(map(int, input().split()))
    print(yourname(N, K, D))

if __name__ == '__main__':
    main()
0