結果
問題 | No.1717 Levi-Civita Triangle |
ユーザー |
![]() |
提出日時 | 2024-02-02 12:34:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 81,952 KB |
実行使用メモリ | 97,152 KB |
最終ジャッジ日時 | 2024-09-28 10:34:47 |
合計ジャッジ時間 | 3,904 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
def f(t):if t in [[0,1,2],[1,2,0],[2,0,1]]:return 1elif t in [[2,1,0],[1,0,2],[0,2,1]]:return 2return 0N = int(input())A = list(map(int, input().split()))if N == 1:print(f(A))exit()ans = [-1] * 4for i in range(2 * N + 1):if A[i] != ans[i%4] and ans[i%4] != -1:print(0)exit()ans[i%4] = A[i]if ans in [[0,1,2,1],[1,2,0,2],[2,0,1,0]]:if N % 2:print(1)else:print(2)elif ans in [[0,2,1,2],[1,0,2,0],[2,1,0,1]]:if N % 2:print(2)else:print(1)else:print(0)