結果

問題 No.1717 Levi-Civita Triangle
ユーザー mahiro72mahiro72
提出日時 2021-10-23 02:46:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 18,340 KB
最終ジャッジ日時 2023-10-24 19:32:08
合計ジャッジ時間 5,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,160 KB
testcase_01 AC 29 ms
10,160 KB
testcase_02 AC 29 ms
10,160 KB
testcase_03 AC 29 ms
10,160 KB
testcase_04 AC 29 ms
10,164 KB
testcase_05 AC 31 ms
10,216 KB
testcase_06 AC 47 ms
10,884 KB
testcase_07 AC 140 ms
14,948 KB
testcase_08 AC 30 ms
10,160 KB
testcase_09 AC 31 ms
10,160 KB
testcase_10 AC 31 ms
10,228 KB
testcase_11 AC 45 ms
10,664 KB
testcase_12 AC 95 ms
12,792 KB
testcase_13 AC 29 ms
10,160 KB
testcase_14 AC 30 ms
10,160 KB
testcase_15 AC 31 ms
10,204 KB
testcase_16 AC 42 ms
10,456 KB
testcase_17 AC 162 ms
15,896 KB
testcase_18 AC 30 ms
10,160 KB
testcase_19 AC 29 ms
10,160 KB
testcase_20 AC 31 ms
10,188 KB
testcase_21 AC 41 ms
10,456 KB
testcase_22 AC 127 ms
14,532 KB
testcase_23 AC 29 ms
10,160 KB
testcase_24 AC 29 ms
10,160 KB
testcase_25 AC 31 ms
10,240 KB
testcase_26 AC 33 ms
10,304 KB
testcase_27 AC 69 ms
11,752 KB
testcase_28 AC 29 ms
10,160 KB
testcase_29 AC 29 ms
10,160 KB
testcase_30 AC 30 ms
10,228 KB
testcase_31 AC 38 ms
10,380 KB
testcase_32 AC 171 ms
16,792 KB
testcase_33 AC 204 ms
18,340 KB
testcase_34 AC 205 ms
18,340 KB
testcase_35 AC 200 ms
18,340 KB
testcase_36 AC 201 ms
18,340 KB
testcase_37 AC 203 ms
18,340 KB
testcase_38 AC 203 ms
18,340 KB
testcase_39 AC 207 ms
18,340 KB
testcase_40 AC 203 ms
18,340 KB
testcase_41 AC 199 ms
18,340 KB
testcase_42 AC 200 ms
18,340 KB
testcase_43 AC 204 ms
18,340 KB
testcase_44 AC 204 ms
18,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(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())
A = list(map(int,input().split()))

N_2 = N-1
A_2 = []

for i in range(2*N-1):
    A_2.append(f(A[i],A[i+1],A[i+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]

print(1 if A_2==one else 2 if A_2==two else 0)
0