結果

問題 No.482 あなたの名は
ユーザー 6soukiti296soukiti29
提出日時 2017-03-21 01:32:29
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 404 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 48,468 KB
最終ジャッジ日時 2023-09-18 13:39:21
合計ジャッジ時間 4,466 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,176 KB
testcase_01 AC 17 ms
7,856 KB
testcase_02 AC 16 ms
7,776 KB
testcase_03 AC 16 ms
7,800 KB
testcase_04 AC 16 ms
7,744 KB
testcase_05 AC 16 ms
7,732 KB
testcase_06 AC 16 ms
7,856 KB
testcase_07 AC 28 ms
8,260 KB
testcase_08 AC 21 ms
8,196 KB
testcase_09 AC 17 ms
7,740 KB
testcase_10 AC 21 ms
8,244 KB
testcase_11 AC 24 ms
8,392 KB
testcase_12 AC 27 ms
8,352 KB
testcase_13 AC 21 ms
8,344 KB
testcase_14 AC 19 ms
8,176 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 #

N,K = map(int,input().split())
L = list(map(int,input().split()))
def min_gokan(A):
	B = [[]]
	i = 0
	A2 = A[:]
	while A2:
		a = A2[0]
		while B[i] == [] or a != B[i][0]:
			B[i].append(a)
			a = A[a - 1]
		A2 = list(set(A2) - set(B[i]))
		i = i + 1
		B.append([])
		
	B.pop()
	r = len(A) - len(B)
	return r
m = min_gokan(L)
if m > K:
	print("NO")
elif (K - m) % 2 == 0:
	print("YES")
else:
	print("NO")
0