結果
問題 |
No.482 あなたの名は
|
ユーザー |
👑 ![]() |
提出日時 | 2020-06-02 14:52:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 119,728 KB |
最終ジャッジ日時 | 2024-11-23 22:45:36 |
合計ジャッジ時間 | 5,079 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
def f(s): return int(s)-1 N,K=map(int,input().split()) D=list(map(f,input().split())) U=set() L=[] for i in range(N): if i not in U: U.add(i) M=[i] x=i while True: x=D[x] if x!=i: U.add(x) M.append(x) else: L.append(M) break S=0 for H in L: S+=len(H)-1 if S<=K and (K-S)%2==0: print("YES") else: print("NO")