結果
問題 | No.1717 Levi-Civita Triangle |
ユーザー |
|
提出日時 | 2022-06-01 14:06:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 454 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 132,232 KB |
最終ジャッジ日時 | 2024-09-21 01:29:56 |
合計ジャッジ時間 | 9,829 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
N = int(input()) A = list(map(int,input().split())) s1 = {(0,1,2),(1,2,0),(2,0,1)} s2 = {(2,1,0),(1,0,2),(0,2,1)} import sys def calc(l): n = len(l) ans = [] for i in range(1,n - 1): if (l[i-1],l[i],l[i+1]) in s1: ans.append(1) elif (l[i-1],l[i],l[i+1]) in s2: ans.append(2) else: ans.append(0) return ans if N <= 20: for _ in range(N): A = calc(A) print(A[0]) exit() else: for _ in range(15): A = calc(A) n = len(A) //2 if A[n-1] == 0 and A[n] == 0 and A[n + 1] == 0: print(0) else: print(A[-1])