結果

問題 No.1717 Levi-Civita Triangle
ユーザー rlangevinrlangevin
提出日時 2024-02-02 12:34:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 98,220 KB
最終ジャッジ日時 2024-02-02 12:35:03
合計ジャッジ時間 4,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 40 ms
59,444 KB
testcase_06 AC 41 ms
62,104 KB
testcase_07 AC 57 ms
82,140 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 40 ms
59,448 KB
testcase_11 AC 40 ms
61,824 KB
testcase_12 AC 50 ms
71,704 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 AC 43 ms
61,940 KB
testcase_17 AC 65 ms
89,676 KB
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 37 ms
53,460 KB
testcase_21 AC 44 ms
61,940 KB
testcase_22 AC 58 ms
80,584 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 37 ms
53,460 KB
testcase_25 AC 43 ms
59,832 KB
testcase_26 AC 41 ms
59,832 KB
testcase_27 AC 50 ms
68,112 KB
testcase_28 AC 38 ms
53,460 KB
testcase_29 AC 37 ms
53,460 KB
testcase_30 AC 42 ms
59,832 KB
testcase_31 AC 43 ms
61,952 KB
testcase_32 AC 66 ms
89,808 KB
testcase_33 AC 76 ms
98,220 KB
testcase_34 AC 72 ms
98,220 KB
testcase_35 AC 72 ms
98,220 KB
testcase_36 AC 72 ms
98,220 KB
testcase_37 AC 73 ms
98,220 KB
testcase_38 AC 71 ms
98,220 KB
testcase_39 AC 78 ms
98,220 KB
testcase_40 AC 73 ms
98,220 KB
testcase_41 AC 72 ms
98,220 KB
testcase_42 AC 72 ms
98,220 KB
testcase_43 AC 71 ms
98,220 KB
testcase_44 AC 72 ms
98,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(t):
    if t in [[0,1,2],[1,2,0],[2,0,1]]:
        return 1
    elif t in [[2,1,0],[1,0,2],[0,2,1]]:
        return 2
    return 0

N = int(input())
A = list(map(int, input().split()))
if N == 1:
    print(f(A))
    exit()
    
ans = [-1] * 4
for i in range(2 * N + 1):
    if A[i] != ans[i%4] and ans[i%4] != -1:
        print(0)
        exit()
    ans[i%4] = A[i]
    
if ans in [[0,1,2,1],[1,2,0,2],[2,0,1,0]]:
    if N % 2:
        print(1)
    else:
        print(2)
elif ans in [[0,2,1,2],[1,0,2,0],[2,1,0,1]]:
    if N % 2:
        print(2)
    else:
        print(1)
else:
    print(0)
0