結果

問題 No.2301 Namorientation
ユーザー 👑 p-adicp-adic
提出日時 2023-05-14 09:21:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 100,352 KB
最終ジャッジ日時 2024-05-07 08:16:49
合計ジャッジ時間 38,736 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,752 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 WA -
testcase_04 AC 31 ms
10,624 KB
testcase_05 WA -
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,624 KB
testcase_08 AC 32 ms
10,624 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 32 ms
10,752 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,470 ms
96,000 KB
testcase_23 AC 1,425 ms
94,592 KB
testcase_24 AC 1,161 ms
80,768 KB
testcase_25 AC 1,100 ms
75,180 KB
testcase_26 AC 1,451 ms
97,460 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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])==1:
		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]):
		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