結果
| 問題 | No.1717 Levi-Civita Triangle | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-03-20 21:05:38 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 757 bytes | 
| コンパイル時間 | 206 ms | 
| コンパイル使用メモリ | 82,780 KB | 
| 実行使用メモリ | 158,872 KB | 
| 最終ジャッジ日時 | 2025-03-20 21:05:52 | 
| 合計ジャッジ時間 | 4,978 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 TLE * 1 -- * 28 | 
ソースコード
def main():
    import sys
    input = sys.stdin.read().split()
    n = int(input[0])
    arr = list(map(int, input[1:]))
    
    current = arr
    for _ in range(n):
        m = len(current)
        if m < 3:
            break
        new = []
        for i in range(m - 2):
            a, b, c = current[i], current[i+1], current[i+2]
            if (a, b, c) in {(0,1,2), (1,2,0), (2,0,1)}:
                new.append(1)
            elif (a, b, c) in {(2,1,0), (1,0,2), (0,2,1)}:
                new.append(2)
            else:
                new.append(0)
        # Check if all new are zero
        if all(x == 0 for x in new):
            print(0)
            return
        current = new
    print(current[0])
if __name__ == '__main__':
    main()
            
            
            
        