結果
| 問題 | No.1717 Levi-Civita Triangle | 
| コンテスト | |
| ユーザー |  Koi | 
| 提出日時 | 2025-07-15 18:21:26 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,390 bytes | 
| コンパイル時間 | 461 ms | 
| コンパイル使用メモリ | 82,584 KB | 
| 実行使用メモリ | 99,696 KB | 
| 最終ジャッジ日時 | 2025-07-15 18:21:31 | 
| 合計ジャッジ時間 | 4,363 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 WA * 28 | 
ソースコード
# N = int(input())
# A = list(map(int, input().split()))
def gutyoku(A):
    L = A[:]
    while len(L) > 1:
        Q = []
        for i in range(len(L) - 2):
            T = (L[i], L[i + 1], L[i + 2])
            if(T in ((0, 1, 2), (1, 2, 0), (2, 0, 1))):
                Q.append(1)
            elif(T in ((2,1,0),(1,0,2),(0,2,1))):
                Q.append(2)
            else:
                Q.append(0)
        # print(L, Q)
        L = Q[:]
    return L[0]
# N = 7
# for i in range(3 ** (2 * N + 1)):
#     x = i
#     A = []
#     for j in range(2 * N + 1):
#         A.append(x % 3)
#         x //= 3
#     ans = gutyoku(A)
#     if(ans != 0):
#         print(A, ans)
N = int(input())
A = list(map(int, input().split()))
# print(gutyoku(A))
#L = [ [1, 0, 2, 0], [0, 2, 1, 2], [2, 1, 0, 1], [1, 2, 0, 2], [2, 0, 1, 0], [0, 1, 2, 1]]
L = [[2, 1, 0, 1], [0, 2, 1, 2], [1, 0, 2, 0], [1, 2, 0, 2], [2, 0, 1, 0], [0, 1, 2, 1]]
Nxts = [4, 4, 4, 2, 2, 2]
for j in range(len(L)):
    is_j = True
    for i in range(2 * N + 1):
        if(A[i] != L[j][i % 4]):
            is_j = False
            break
    if(is_j):
        nowj = j
        # print(nowj)
        while N > 10:
            N -= 2
            nowj = Nxts[j]
        B = []
        for i in range(2 * N + 1):
            B.append(L[nowj][i % 4])
        # print(nowj, N, B)
        print(gutyoku(B))
        exit()
print(0)
            
            
            
        