結果
| 問題 |
No.482 あなたの名は
|
| ユーザー |
Yamada
|
| 提出日時 | 2019-01-14 00:46:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 488 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 59,900 KB |
| 最終ジャッジ日時 | 2024-12-29 15:39:26 |
| 合計ジャッジ時間 | 47,295 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 TLE * 15 |
ソースコード
def check(L,M):
B =list()
B.append(M[0])
M.remove(M[0])
while B[0] != L[B[-1]]:
B.append(L[B[-1]])
M.remove(B[-1])
return M
N,K = map(int,input().split())
l = {i+1:int(j) for i,j in enumerate(input().split())}
m = [i+1 for i in range(N)]
#print(l)
#print(m)
for i in range(1,N+1):
if l[i] == i:
m.remove(i)
a = len(m)
while len(m) != 0:
a -= 1
m = check(l,m)
if K -a >= 0 and (K-a)%2 == 0:
print("YES")
else:
print("NO")
Yamada