結果
| 問題 |
No.1254 補強への架け橋
|
| コンテスト | |
| ユーザー |
googol_S0
|
| 提出日時 | 2020-10-09 22:03:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 613 bytes |
| コンパイル時間 | 320 ms |
| コンパイル使用メモリ | 82,396 KB |
| 実行使用メモリ | 291,964 KB |
| 最終ジャッジ日時 | 2024-07-20 11:29:25 |
| 合計ジャッジ時間 | 26,272 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 110 |
ソースコード
import sys
sys.setrecursionlimit(10**9)
N=int(input())
a,b=0,0
G=[[] for i in range(N)]
D=[-1]*N
for i in range(N):
a,b=map(int,input().split())
a,b=a-1,b-1
G[a].append((b,i+1))
G[b].append((a,i+1))
P=[]
def dfsr(n,x,y):
global P
for i in range(len(G[n])):
if G[n][i][0]==x and D[n]==y:
P.append(G[n][i][1])
print(len(P))
print(*P)
exit()
if D[n]+1==D[G[n][i][0]]:
P.append(G[n][i][1])
dfsr(G[n][i][0],x,y)
def dfs(n,p,d):
if D[n]!=-1:
dfsr(n,n,d-1)
D[n]=d
for i in range(len(G[n])):
if G[n][i][0]!=p:
dfs(G[n][i][0],n,d+1)
dfs(0,-1,0)
googol_S0