結果

問題 No.100 直列あみだくじ
ユーザー 👑 colognecologne
提出日時 2022-02-02 15:29:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 75,144 KB
最終ジャッジ日時 2023-09-02 02:48:43
合計ジャッジ時間 6,076 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,124 KB
testcase_01 AC 66 ms
71,288 KB
testcase_02 AC 69 ms
71,168 KB
testcase_03 AC 67 ms
74,808 KB
testcase_04 AC 75 ms
74,972 KB
testcase_05 AC 68 ms
71,212 KB
testcase_06 AC 65 ms
71,284 KB
testcase_07 AC 71 ms
71,124 KB
testcase_08 AC 67 ms
71,292 KB
testcase_09 AC 69 ms
71,376 KB
testcase_10 AC 66 ms
71,288 KB
testcase_11 AC 66 ms
71,060 KB
testcase_12 AC 69 ms
71,196 KB
testcase_13 AC 68 ms
71,088 KB
testcase_14 AC 66 ms
71,084 KB
testcase_15 AC 67 ms
71,344 KB
testcase_16 AC 67 ms
71,128 KB
testcase_17 AC 66 ms
71,276 KB
testcase_18 AC 66 ms
71,192 KB
testcase_19 AC 68 ms
71,388 KB
testcase_20 AC 67 ms
71,348 KB
testcase_21 AC 66 ms
71,324 KB
testcase_22 AC 66 ms
71,316 KB
testcase_23 AC 64 ms
71,120 KB
testcase_24 AC 65 ms
71,284 KB
testcase_25 AC 69 ms
71,384 KB
testcase_26 AC 69 ms
71,464 KB
testcase_27 AC 68 ms
71,164 KB
testcase_28 AC 67 ms
71,492 KB
testcase_29 AC 68 ms
71,216 KB
testcase_30 AC 71 ms
75,144 KB
testcase_31 AC 70 ms
71,120 KB
testcase_32 AC 73 ms
74,976 KB
testcase_33 AC 68 ms
71,388 KB
testcase_34 AC 68 ms
71,120 KB
testcase_35 AC 69 ms
71,288 KB
testcase_36 AC 73 ms
75,004 KB
testcase_37 AC 68 ms
71,308 KB
testcase_38 AC 70 ms
74,992 KB
testcase_39 AC 69 ms
71,432 KB
testcase_40 AC 69 ms
71,384 KB
testcase_41 AC 70 ms
71,304 KB
testcase_42 AC 69 ms
71,224 KB
testcase_43 AC 68 ms
71,428 KB
testcase_44 AC 69 ms
71,092 KB
testcase_45 AC 66 ms
71,352 KB
testcase_46 AC 69 ms
71,284 KB
testcase_47 AC 69 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    *A, = map(lambda x: int(x)-1, input().split())

    D = {}

    for i in range(N):
        c = 1
        j = A[i]
        while j != i:
            c += 1
            j = A[j]
        D[c] = D.get(c, 0) + 1

    for k, v in D.items():
        if k % 2 == 0 and (v // k) % 2 == 1:
            print('No')
            return
    print('Yes')


if __name__ == '__main__':
    main()
0