結果

問題 No.482 あなたの名は
ユーザー けむけむけむけむ
提出日時 2021-09-12 14:26:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 559 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 34,456 KB
最終ジャッジ日時 2023-09-06 09:00:39
合計ジャッジ時間 5,441 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,324 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 15 ms
7,812 KB
testcase_03 AC 16 ms
7,956 KB
testcase_04 AC 16 ms
7,788 KB
testcase_05 AC 17 ms
7,820 KB
testcase_06 AC 16 ms
7,852 KB
testcase_07 AC 19 ms
8,228 KB
testcase_08 AC 17 ms
7,776 KB
testcase_09 AC 17 ms
7,872 KB
testcase_10 AC 18 ms
7,856 KB
testcase_11 AC 18 ms
7,756 KB
testcase_12 AC 18 ms
8,384 KB
testcase_13 AC 18 ms
7,760 KB
testcase_14 AC 17 ms
7,820 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def yourname(N, K, D):
    iniD = [n for n in range(1, N + 1)]
    for i in range(len(D)):
        d = D[i]
        if iniD[i] == d:
            continue
        else:
            idx = iniD.index(d)
            iniD[i], iniD[idx] = iniD[idx], iniD[i]
            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