結果

問題 No.482 あなたの名は
ユーザー trineutrontrineutron
提出日時 2021-01-12 12:00:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 29,688 KB
最終ジャッジ日時 2024-05-01 07:04:46
合計ジャッジ時間 5,611 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,624 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 25 ms
10,624 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 WA -
testcase_13 AC 26 ms
10,624 KB
testcase_14 AC 27 ms
10,624 KB
testcase_15 AC 203 ms
29,428 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 204 ms
29,556 KB
testcase_19 AC 222 ms
29,556 KB
testcase_20 AC 215 ms
29,556 KB
testcase_21 AC 202 ms
29,680 KB
testcase_22 AC 201 ms
29,556 KB
testcase_23 AC 206 ms
29,680 KB
testcase_24 AC 211 ms
29,680 KB
testcase_25 AC 206 ms
29,432 KB
testcase_26 WA -
testcase_27 AC 201 ms
29,424 KB
testcase_28 WA -
testcase_29 AC 181 ms
29,424 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
d = list(map(int, input().split()))
idx = [0] * n
for i in range(n):
    d[i] -= 1
    idx[d[i]] = i
swaps = 0
for i in range(n):
    if d[i] == i:
        continue
    x = idx[i]
    d[i], d[x] = d[x], d[i]
    swaps += 1
if k >= swaps and (k - swaps) % 2 == 0:
    print('YES')
else:
    print('NO')
0