結果

問題 No.482 あなたの名は
ユーザー hedwig100hedwig100
提出日時 2020-07-04 16:20:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 31,896 KB
最終ジャッジ日時 2023-10-19 07:41:53
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,148 KB
testcase_01 AC 28 ms
10,148 KB
testcase_02 AC 28 ms
10,148 KB
testcase_03 AC 32 ms
10,148 KB
testcase_04 AC 32 ms
10,148 KB
testcase_05 AC 29 ms
10,148 KB
testcase_06 AC 29 ms
10,148 KB
testcase_07 AC 29 ms
10,244 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 29 ms
10,188 KB
testcase_11 AC 29 ms
10,228 KB
testcase_12 AC 30 ms
10,244 KB
testcase_13 AC 30 ms
10,188 KB
testcase_14 AC 29 ms
10,184 KB
testcase_15 AC 156 ms
31,896 KB
testcase_16 AC 159 ms
31,896 KB
testcase_17 AC 160 ms
31,896 KB
testcase_18 AC 158 ms
31,896 KB
testcase_19 AC 159 ms
31,896 KB
testcase_20 AC 157 ms
31,896 KB
testcase_21 AC 163 ms
31,896 KB
testcase_22 AC 160 ms
31,896 KB
testcase_23 AC 160 ms
31,896 KB
testcase_24 AC 159 ms
31,896 KB
testcase_25 AC 159 ms
31,896 KB
testcase_26 AC 159 ms
31,896 KB
testcase_27 AC 166 ms
31,896 KB
testcase_28 AC 160 ms
31,896 KB
testcase_29 AC 130 ms
31,896 KB
testcase_30 AC 29 ms
10,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N,K = map(int,input().split())
    D = list(map(int,input().split()))
    D = [d - 1 for d in D]
    idx = [-1] * N
    for i,d in enumerate(D):
        idx[d] = i
    
    min_cnt = 0
    for i in range(N):
        if idx[i] == i:
            continue
        idx[D[i]] = idx[i]
        D[idx[i]] = D[i]
        D[i] = i
        idx[i] = i
        min_cnt += 1
    print('YES' if (K - min_cnt)%2 == 0 else 'NO')
if __name__ == '__main__':
    main()
0