結果

問題 No.100 直列あみだくじ
ユーザー maspymaspy
提出日時 2020-01-01 18:29:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-08-14 15:08:35
合計ジャッジ時間 3,369 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 15 ms
7,808 KB
testcase_06 AC 15 ms
7,784 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 15 ms
7,788 KB
testcase_10 AC 15 ms
7,956 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 15 ms
7,720 KB
testcase_15 WA -
testcase_16 AC 15 ms
7,852 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 15 ms
7,952 KB
testcase_20 AC 15 ms
7,880 KB
testcase_21 AC 15 ms
7,948 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 15 ms
7,840 KB
testcase_25 WA -
testcase_26 AC 15 ms
7,868 KB
testcase_27 AC 15 ms
7,888 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 15 ms
7,976 KB
testcase_32 WA -
testcase_33 AC 15 ms
7,892 KB
testcase_34 AC 15 ms
7,784 KB
testcase_35 WA -
testcase_36 AC 15 ms
7,904 KB
testcase_37 WA -
testcase_38 AC 15 ms
7,952 KB
testcase_39 WA -
testcase_40 AC 15 ms
7,720 KB
testcase_41 WA -
testcase_42 AC 15 ms
7,812 KB
testcase_43 AC 15 ms
7,768 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 15 ms
7,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・巡回置換の長さ
・2n+1 -> 2n+1
・2n -> n, n
・結局、偶数は同数ずつないといけないというのが条件
"""

N,*A = map(int,read().split())

A = [0] + A

period = [0] * (N+1)
for i,x in enumerate(A):
    p = 0
    y = x
    while True:
        y = A[y]
        p += 1
        if y == x:
            break
    period[i] = p

counter = [0] * (N+10)
for x in period[1:]:
    counter[x] += 1

answer = 'Yes'
for i in range(0,N+10,2):
    if counter[i] % 2 != 0:
        answer = 'No'

print(answer)
0