結果

問題 No.1717 Levi-Civita Triangle
ユーザー hari64
提出日時 2021-10-22 23:10:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 1,354 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,980 KB
実行使用メモリ 130,012 KB
最終ジャッジ日時 2024-09-23 07:37:13
合計ジャッジ時間 7,956 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

N = int(input())
As = list(map(int, input().split()))
cnt = 0
while len(As) >= 3 and cnt <= 30:
cnt += 1
Bs = [None]*(len(As)-2)
for i in range(1, len(As)-1):
if (As[i - 1] == 0 and As[i] == 1 and As[i + 1] == 2):
Bs[i - 1] = 1
elif (As[i - 1] == 1 and As[i] == 2 and As[i + 1] == 0):
Bs[i - 1] = 1
elif (As[i - 1] == 2 and As[i] == 0 and As[i + 1] == 1):
Bs[i - 1] = 1
elif (As[i - 1] == 2 and As[i] == 1 and As[i + 1] == 0):
Bs[i - 1] = 2
elif (As[i - 1] == 1 and As[i] == 0 and As[i + 1] == 2):
Bs[i - 1] = 2
elif (As[i - 1] == 0 and As[i] == 2 and As[i + 1] == 1):
Bs[i - 1] = 2
else:
Bs[i - 1] = 0
As = Bs
# print(As)
if (len(As) == 1):
print(As[0])
exit()
if all(i == 0 for i in As[1::2]):
if all(i == 2 for i in As[::4]) and all(i == 1 for i in As[2::4]) and len(As) % 4 == 3:
print(1)
elif all(i == 1 for i in As[::4]) and all(i == 2 for i in As[2::4]) and len(As) % 4 == 1:
print(1)
elif all(i == 2 for i in As[::4]) and all(i == 1 for i in As[2::4]) and len(As) % 4 == 1:
print(2)
elif all(i == 1 for i in As[::4]) and all(i == 2 for i in As[2::4]) and len(As) % 4 == 3:
print(2)
else:
print(0)
else:
print(0)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0