Logo
(追記) (追記ここまで)

23594번 - Vasya's graph 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 256 MB18121164.706%

문제

Vasya has got a graph. The graph has $N$ nodes, but it's got no eges yet. Vasya cares a lot about the future graph structure: he knows $K$ pairs of nodes {$u_j,ドル $v_j$}, such that if there is a path between these nodes in the graph, the irredeemable will happen to the graph. Vasya must prevent it at all costs.

Vasya has made a list of $M$ unoriented edges. Vasya will examine the edges in the preset order and he will surely put them into the graph, if possible. If adding another edge will cause the irredeemable, Vasya will simply discard such an edge. Your task is to find out which edges are good for the graph and which ones must end up in the trash.

입력

The first line of the input file contains three integers $N,ドル $K$ and $M$ (1ドル \leq N \leq 10^5,ドル 0ドル \leq K, M \leq 10^5$).

It is followed by $K$ lines, with the $i$-th line containing two integers $u_i$ and $v_i$ --- the numbers of conflicting nodes, which should not have any edges between them (1ドル \leq u_i < v_i \leq N$). The conflicting node pairs are unique.

Next come $M$ lines with the $i$-th line containing two integers $\tilde u_i$ and $\tilde v_i$ --- the numbers of nodes of the edge which can be added to the graph (1ドル \leq \tilde u_i < \tilde v_i \leq N$). These edges are provided in the order of examination. Edges in the list are unique.

출력

The first line of the output file must contain the number of edges that Vasya can accomodate into the graph. The second line must contain space-separated numbers of edges in the ascending order.

제한

예제 입력 1

3 1 3
1 2
1 2
2 3
1 3

예제 출력 1

1
2

예제 입력 2

5 2 6
1 2
2 3
1 3
2 4
3 4
1 4
4 5
1 5

예제 출력 2

3
1 2 5

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 4: Grand Prix of Eurasia D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /