結果

問題 No.2301 Namorientation
ユーザー 👑 p-adicp-adic
提出日時 2023-05-14 09:18:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 435 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 100,224 KB
最終ジャッジ日時 2024-05-07 08:15:20
合計ジャッジ時間 27,139 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 AC 26 ms
10,624 KB
testcase_07 RE -
testcase_08 AC 27 ms
10,752 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 26 ms
10,496 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 1,258 ms
95,744 KB
testcase_23 AC 1,241 ms
94,592 KB
testcase_24 AC 1,141 ms
80,768 KB
testcase_25 AC 1,064 ms
75,052 KB
testcase_26 AC 1,235 ms
97,364 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

I,J,R=input,int,range
N=J(I())
M=R(N)
E,V=[[] for n in M],[set() for n in M]
for n in M:
	X=I().split()
	E[n]=[J(X[0])-1,J(X[1])-1,0]
	for i in R(2):V[E[n][i]].add(n)
for n in M:
	v=n
	while len(V[v])<2:
		e=V[v].pop()
		i=v==E[e][0]
		w,E[e][2]=E[e][i],i
		V[w].remove(e)
		v=w
for v in M:
	while len(V[v])>0:
		e=V[v].pop()
		i=v==E[e][0]
		w,E[e][2]=E[e][i],i
		V[w].remove(e)
		v=w
		break
for n in M:print("->"if E[n][2] else"<-")
0