結果
| 問題 | No.1717 Levi-Civita Triangle | 
| コンテスト | |
| ユーザー |  taiga0629kyopro | 
| 提出日時 | 2021-10-22 23:54:10 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 162 ms / 2,000 ms | 
| コード長 | 875 bytes | 
| コンパイル時間 | 429 ms | 
| コンパイル使用メモリ | 82,400 KB | 
| 実行使用メモリ | 148,072 KB | 
| 最終ジャッジ日時 | 2024-09-24 07:12:47 | 
| 合計ジャッジ時間 | 5,110 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 42 | 
ソースコード
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)
            
            
            
        