結果
| 問題 |
No.100 直列あみだくじ
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-12-06 22:40:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 5,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 132 ms |
| コンパイル使用メモリ | 82,004 KB |
| 実行使用メモリ | 55,928 KB |
| 最終ジャッジ日時 | 2024-09-17 13:20:58 |
| 合計ジャッジ時間 | 3,168 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
ソースコード
n = int(input())
*r, = map(int,input().split())
for i in range(n): r[i] -= 1
from collections import Counter
d = Counter()
used = [0]*n
for i in range(n):
if used[i]: continue
cnt = 0
while used[i]==0:
used[i] = 1
i = r[i]
cnt += 1
d[cnt] += 1
print("No" if any(k%2==0 and v%2==1 for k,v in d.items()) else "Yes")
convexineq