結果

問題 No.482 あなたの名は
ユーザー tookunn_1213tookunn_1213
提出日時 2017-02-10 23:54:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 290 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 29,988 KB
最終ジャッジ日時 2023-08-28 10:21:56
合計ジャッジ時間 4,170 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,900 KB
testcase_01 AC 15 ms
7,848 KB
testcase_02 AC 15 ms
7,828 KB
testcase_03 AC 16 ms
7,792 KB
testcase_04 AC 17 ms
7,752 KB
testcase_05 AC 16 ms
7,792 KB
testcase_06 AC 16 ms
7,796 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 WA -
testcase_09 AC 15 ms
7,752 KB
testcase_10 AC 16 ms
7,896 KB
testcase_11 AC 15 ms
7,812 KB
testcase_12 AC 16 ms
7,772 KB
testcase_13 AC 16 ms
7,796 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 150 ms
29,832 KB
testcase_18 AC 153 ms
29,872 KB
testcase_19 WA -
testcase_20 AC 155 ms
29,820 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 152 ms
29,836 KB
testcase_25 AC 155 ms
29,948 KB
testcase_26 AC 157 ms
29,824 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 159 ms
29,820 KB
testcase_30 AC 15 ms
7,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
D = list(map(int,input().split()))
cnt = 0
for i in range(N):
	if D[i] != i+1:
		a,b = D[i]-1,D[D[i]-1]-1
		D[a],D[b] = D[b],D[a]
		cnt+=1
def check():
	if cnt >= 3:
		return cnt + 1 <= K
	return (K - cnt) % 2 == 0
if check():
	print('YES')
else:
	print('NO')
0