結果

問題 No.1717 Levi-Civita Triangle
ユーザー zkouzkou
提出日時 2021-08-05 18:14:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,588 KB
実行使用メモリ 103,416 KB
最終ジャッジ日時 2023-10-24 11:27:59
合計ジャッジ時間 4,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,360 KB
testcase_01 AC 37 ms
53,360 KB
testcase_02 AC 36 ms
53,360 KB
testcase_03 AC 36 ms
53,360 KB
testcase_04 AC 36 ms
53,360 KB
testcase_05 AC 64 ms
62,304 KB
testcase_06 AC 110 ms
78,160 KB
testcase_07 AC 134 ms
92,148 KB
testcase_08 AC 36 ms
53,368 KB
testcase_09 AC 36 ms
53,368 KB
testcase_10 AC 48 ms
64,368 KB
testcase_11 AC 104 ms
77,208 KB
testcase_12 AC 118 ms
85,088 KB
testcase_13 AC 36 ms
53,368 KB
testcase_14 AC 36 ms
53,368 KB
testcase_15 AC 40 ms
58,824 KB
testcase_16 AC 58 ms
72,652 KB
testcase_17 AC 102 ms
97,144 KB
testcase_18 AC 36 ms
53,368 KB
testcase_19 AC 36 ms
53,368 KB
testcase_20 AC 40 ms
58,824 KB
testcase_21 AC 57 ms
72,664 KB
testcase_22 AC 92 ms
102,192 KB
testcase_23 AC 36 ms
53,368 KB
testcase_24 AC 37 ms
53,368 KB
testcase_25 AC 49 ms
64,388 KB
testcase_26 AC 54 ms
68,556 KB
testcase_27 AC 65 ms
81,092 KB
testcase_28 AC 37 ms
53,368 KB
testcase_29 AC 37 ms
53,368 KB
testcase_30 AC 46 ms
62,292 KB
testcase_31 AC 56 ms
70,604 KB
testcase_32 AC 101 ms
97,208 KB
testcase_33 AC 113 ms
103,416 KB
testcase_34 AC 113 ms
103,416 KB
testcase_35 AC 113 ms
103,416 KB
testcase_36 AC 113 ms
103,416 KB
testcase_37 AC 114 ms
103,416 KB
testcase_38 AC 112 ms
103,416 KB
testcase_39 AC 113 ms
103,416 KB
testcase_40 AC 113 ms
103,416 KB
testcase_41 AC 113 ms
103,416 KB
testcase_42 AC 114 ms
103,416 KB
testcase_43 AC 112 ms
103,416 KB
testcase_44 AC 113 ms
103,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def LeviCivitaSymbol(a, b, c):
    if (a, b, c) in ((0, 1, 2), (1, 2, 0), (2, 0, 1)):
        return 1
    elif (a, b, c) in ((2, 1, 0), (1, 0, 2), (0, 2, 1)):
        return 2
    else:
        return 0

N = int(input())
As = list(map(int, input().split()))

# 一度だけ操作を施した数列を As_2 として用意する。
N_2 = N - 1
As_2 = []
for i in range(2 * N - 1):
    As_2.append(LeviCivitaSymbol(As[i], As[i + 1], As[i + 2]))

# 答えが 1, 2 になる数列の生成
if N_2 % 2 == 0:
    one = [1, 0, 2, 0] * (N_2 // 2) + [1]
    two = [2, 0, 1, 0] * (N_2 // 2) + [2]
else:
    one = [2, 0, 1, 0] * (N_2 // 2) + [2, 0, 1]
    two = [1, 0, 2, 0] * (N_2 // 2) + [1, 0, 2]

if As_2 == one:
    print(1)
elif As_2 == two:
    print(2)
else:
    print(0)
0