結果

問題 No.1717 Levi-Civita Triangle
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-10-22 23:54:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 875 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 147,820 KB
最終ジャッジ日時 2023-10-24 16:12:41
合計ジャッジ時間 5,305 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,368 KB
testcase_01 AC 37 ms
53,368 KB
testcase_02 AC 35 ms
53,368 KB
testcase_03 AC 36 ms
53,368 KB
testcase_04 AC 36 ms
53,368 KB
testcase_05 AC 45 ms
62,164 KB
testcase_06 AC 55 ms
75,188 KB
testcase_07 AC 110 ms
123,716 KB
testcase_08 AC 35 ms
53,368 KB
testcase_09 AC 35 ms
53,368 KB
testcase_10 AC 44 ms
62,164 KB
testcase_11 AC 54 ms
73,752 KB
testcase_12 AC 84 ms
107,276 KB
testcase_13 AC 36 ms
53,368 KB
testcase_14 AC 35 ms
53,368 KB
testcase_15 AC 37 ms
53,368 KB
testcase_16 AC 51 ms
72,432 KB
testcase_17 AC 104 ms
127,920 KB
testcase_18 AC 35 ms
53,368 KB
testcase_19 AC 36 ms
53,368 KB
testcase_20 AC 40 ms
59,420 KB
testcase_21 AC 51 ms
68,328 KB
testcase_22 AC 79 ms
102,500 KB
testcase_23 AC 34 ms
53,368 KB
testcase_24 AC 35 ms
53,368 KB
testcase_25 AC 46 ms
62,184 KB
testcase_26 AC 50 ms
66,288 KB
testcase_27 AC 72 ms
94,080 KB
testcase_28 AC 36 ms
53,368 KB
testcase_29 AC 35 ms
53,368 KB
testcase_30 AC 43 ms
62,164 KB
testcase_31 AC 50 ms
68,336 KB
testcase_32 AC 113 ms
128,512 KB
testcase_33 AC 122 ms
130,496 KB
testcase_34 AC 147 ms
134,304 KB
testcase_35 AC 110 ms
130,232 KB
testcase_36 AC 136 ms
130,496 KB
testcase_37 AC 116 ms
130,496 KB
testcase_38 AC 156 ms
147,820 KB
testcase_39 AC 150 ms
134,300 KB
testcase_40 AC 124 ms
130,496 KB
testcase_41 AC 134 ms
130,496 KB
testcase_42 AC 106 ms
130,232 KB
testcase_43 AC 153 ms
147,820 KB
testcase_44 AC 114 ms
130,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
m=2*n+1
x=list(map(int,input().split()))

one=[(0,1,2),(1,2,0),(2,0,1)]
two=[(2,1,0),(1,0,2),(0,2,1)]
def f(x):

    while len(x)>1:
        y=[]
        for i in range(len(x)-2):
            tup=(x[i],x[i+1],x[i+2])
            if tup in one:y.append(1)
            elif tup in two:y.append(2)
            else:y.append(0)
        x=y
    return x[0]

res=[]


for i in range(m):
    if len(res)==0:res.append(0)
    elif res[-1]==0:res.append(1)
    elif res[-1]==2:res.append(1)
    else:
        if res[-2]==0:res.append(2)
        else:res.append(0)

p=[(0,1,2),(1,2,0),(2,0,1),(2,1,0),(1,0,2),(0,2,1)]


for tup in p:
    res1=[]
    for i in range(m):
        res1.append(tup[res[i]])
    if x==res1:
        y=tuple((res1[:3]))
        if y in one:ans=1
        else:ans=2
        if n%2==0:ans=3-ans

        print(ans)

        exit()




print(0)

0