結果

問題 No.100 直列あみだくじ
ユーザー yaoshimax
提出日時 2015-03-09 23:18:43
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 16:59:44
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
a=map(int,raw_input().split())
for i in range(len(a)):
    if a[i]!=-1 and a[i]!=i+1:
        cnt=1
        cur=i
        while a[cur]!=i+1:
            cnt+=1
            tmp=cur
            cur=a[cur]-1
            a[tmp]=-1
        a[cur]=-1
        if cnt % 2 == 0:
            print "No"
            exit()
print "Yes"
            
0