結果
問題 |
No.1717 Levi-Civita Triangle
|
ユーザー |
![]() |
提出日時 | 2021-10-22 23:47:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 903 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,544 KB |
実行使用メモリ | 148,732 KB |
最終ジャッジ日時 | 2024-09-24 07:01:04 |
合計ジャッジ時間 | 5,076 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 17 |
ソースコード
n=int(input()) m=2*n+1 x=list(map(int,input().split())) one=[(0,1,2),(1,2,0),(2,0,1)] two=[(2,1,0),(1,0,2),(0,2,1)] def f(x): while len(x)>1: y=[] for i in range(len(x)-2): tup=(x[i],x[i+1],x[i+2]) if tup in one:y.append(1) elif tup in two:y.append(2) else:y.append(0) x=y return x[0] res=[] for i in range(m): if len(res)==0:res.append(0) elif res[-1]==0:res.append(1) elif res[-1]==2:res.append(1) else: if res[-2]==0:res.append(2) else:res.append(0) p=[(0,1,2),(1,2,0),(2,0,1),(2,1,0),(1,0,2),(0,2,1)] for tup in p: res1=[] for i in range(m): res1.append(tup[res[i]]) if x==res1: y=tuple((res1[:2])) if y in one:ans=1 else:ans=2 if n%2==0:ans+=1 if ans%2==1:print(2) else:print(1) exit() print(0)