結果

問題 No.100 直列あみだくじ
ユーザー tnodino
提出日時 2022-04-10 12:51:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-30 21:54:48
合計ジャッジ時間 3,292 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int,input().split()))
flg = [1] * N
cnt = 0
for i in range(N):
    if flg[i]:
        idx = i
        Roop = 0
        while flg[idx]:
            flg[idx] = 0
            idx = a[idx] - 1
            Roop += 1
        if Roop % 2 == 0:
            cnt += 1
if cnt % 2 == 0:
    print('Yes')
else:
    print('No')
0