結果

問題 No.2301 Namorientation
ユーザー 👑 p-adicp-adic
提出日時 2023-05-14 09:42:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,851 ms / 3,000 ms
コード長 426 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 100,224 KB
最終ジャッジ日時 2024-05-07 08:27:10
合計ジャッジ時間 36,838 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 31 ms
10,624 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 30 ms
10,624 KB
testcase_11 AC 31 ms
10,752 KB
testcase_12 AC 1,065 ms
64,256 KB
testcase_13 AC 963 ms
59,392 KB
testcase_14 AC 1,819 ms
99,584 KB
testcase_15 AC 1,166 ms
70,272 KB
testcase_16 AC 1,522 ms
87,040 KB
testcase_17 AC 1,088 ms
66,432 KB
testcase_18 AC 1,548 ms
88,704 KB
testcase_19 AC 923 ms
56,320 KB
testcase_20 AC 1,548 ms
88,064 KB
testcase_21 AC 1,142 ms
69,376 KB
testcase_22 AC 1,441 ms
96,000 KB
testcase_23 AC 1,432 ms
94,592 KB
testcase_24 AC 1,168 ms
80,768 KB
testcase_25 AC 1,078 ms
75,176 KB
testcase_26 AC 1,427 ms
97,480 KB
testcase_27 AC 1,851 ms
99,968 KB
testcase_28 AC 1,841 ms
100,096 KB
testcase_29 AC 1,827 ms
100,224 KB
testcase_30 AC 1,844 ms
99,968 KB
testcase_31 AC 1,842 ms
100,096 KB
権限があれば一括ダウンロードができます

ソースコード

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
for n in M:print("->"if E[n][2] else"<-")
0