結果
| 問題 | No.100 直列あみだくじ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-10 19:56:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 5,000 ms |
| コード長 | 551 bytes |
| コンパイル時間 | 106 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-24 01:36:41 |
| 合計ジャッジ時間 | 2,601 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
ソースコード
#!/usr/bin/env python3
import collections
import functools
import operator
N = int(input())
a = [0] + list(map(int, input().split()))
rest = list(range(len(a)))
loop = collections.defaultdict(int)
while True:
if len(rest) == 0:
break
now = rest[0]
count = 0
while True:
rest.remove(now)
now = a[now]
count += 1
if now not in rest:
loop[count] += 1
break
for k, v in loop.items():
if k % 2 == 1 or v % 2 == 0:
continue
print("No")
exit()
print("Yes")