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

18451번 - Expected Value 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 512 MB32141145.833%

문제

You are given a connected plane graph on n vertices. At first, you are standing at vertex 1. Then, each second you are going to some vertex adjacent to the current one: the destination vertex is chosen uniformly at random among all adjacent vertices. Your task is to calculate the expected value of the first time you arrive at vertex n.

입력

The first line of input contains one integer n: the number of vertices in the given plane graph (2 ≤ n ≤ 3000).

The next n lines contain the description of the points where vertices are located. The i-th of them contains two integers xi and yi (0 ≤ xi, yi ≤ 5000). It is guaranteed that all given points are distinct.

The next line of input contains one integer m: the number of edges in the given plane graph (n − 1 ≤ m ≤ n·(n−1)/2).

The next m lines describe edges of the graph. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi). It means that there is an edge between vertices ai and bi which is the segment between the corresponding points. It is guaranteed that no two of the given segments are intersecting (they can intersect only at the common ends), there are no multiple edges, and the graph is connected.

출력

It is guaranteed that, in the given tests, the required expected value can be represented as an irreducible fraction P/Q where P, Q > 0. You need to print the value (P · Q−1) modulo 998 244 353.

제한

예제 입력 1

2
0 0
35 35
1
1 2

예제 출력 1

1

예제 입력 2

6
0 0
1 1
2 4
3 9
4 16
5 25
8
1 2
2 3
2 4
3 4
4 5
5 6
1 6
2 6

예제 출력 2

798595486

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 1: 300iq Contest E번

  • 문제를 만든 사람: 300iq
(追記) (追記ここまで)

출처

대학교 대회

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

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