結果
| 問題 |
No.100 直列あみだくじ
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2023-04-07 16:22:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 5,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 115 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-02 18:40:55 |
| 合計ジャッジ時間 | 3,030 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
ソースコード
import sys
readline=sys.stdin.readline
from collections import Counter
N=int(readline())
A=list(map(int,readline().split()))
for i in range(N):
A[i]-=1
loop=[0]*(N+1)
seen=[False]*N
for i in range(N):
if seen[i]:
continue
cnt=0
while not seen[i]:
seen[i]=True
i=A[i]
cnt+=1
loop[cnt]+=1
ans="Yes"
for i in range(N+1):
if i%2==0 and loop[i]%2:
ans="No"
print(ans)
vwxyz