結果

問題 No.482 あなたの名は
ユーザー 6soukiti296soukiti29
提出日時 2017-03-21 02:14:12
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 107,164 KB
最終ジャッジ日時 2023-09-18 13:45:36
合計ジャッジ時間 4,811 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,296 KB
testcase_01 AC 71 ms
71,464 KB
testcase_02 AC 71 ms
71,192 KB
testcase_03 AC 72 ms
71,300 KB
testcase_04 AC 71 ms
71,388 KB
testcase_05 AC 71 ms
71,244 KB
testcase_06 AC 70 ms
71,564 KB
testcase_07 AC 71 ms
71,444 KB
testcase_08 AC 70 ms
71,196 KB
testcase_09 AC 70 ms
71,368 KB
testcase_10 AC 70 ms
71,148 KB
testcase_11 AC 72 ms
71,332 KB
testcase_12 AC 71 ms
71,332 KB
testcase_13 AC 71 ms
71,308 KB
testcase_14 AC 71 ms
71,576 KB
testcase_15 AC 120 ms
107,036 KB
testcase_16 AC 122 ms
106,780 KB
testcase_17 AC 119 ms
106,896 KB
testcase_18 AC 120 ms
107,140 KB
testcase_19 AC 119 ms
107,036 KB
testcase_20 AC 120 ms
107,108 KB
testcase_21 AC 118 ms
106,968 KB
testcase_22 AC 120 ms
106,884 KB
testcase_23 AC 122 ms
107,100 KB
testcase_24 AC 122 ms
107,092 KB
testcase_25 AC 121 ms
107,136 KB
testcase_26 AC 117 ms
106,876 KB
testcase_27 AC 119 ms
106,900 KB
testcase_28 AC 120 ms
106,964 KB
testcase_29 AC 117 ms
107,164 KB
testcase_30 AC 72 ms
71,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
L = list(map(int,input().split()))

def min_gokan(A):
	count = 0
	for i in range(len(A)):
		while A[i] - 1 != i:
			A[A[i] - 1],A[i] = A[i],A[A[i] - 1]
			count = count + 1
	return count
m = min_gokan(L)
if m > K:
	print("NO")
elif (K - m) % 2 == 0:
	print("YES")
else:
	print("NO")
0