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

32536번 - Zbunjenost 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB48292255.000%

문제

Mr. Malnar decided to spend his summer traveling around the world by flying randomly. After some time, he found himself in an unknown country’s capital where streets reminded him of a triangulation! More precisely, the city consists of $N$ interesting locations numbered from 1ドル$ to $N$ connected by 2ドルN - 3$ streets. Locations 1,ドル 2, \dots , N$ are connected in that order to form a convex polygon with $N$ sides. Remaining $N - 3$ streets connect locations in such a way that no two streets cross, except maybe at their ends.

While walking the streets of this country’s capital Mr. Malnar found himself at the location where he started from without visiting any location more than once. A bit confused he came to the realization that this is completely normal and came up with a measure of confusion as the number of simple closed loops. Simple closed walk is a sequence of locations $V_1, V_2, \dots , V_m$ such that $V_i$ is connected via street with location $V_{i+1}$ for every $i = 1, 2, \dots , m - 1$ and that location $V_m$ is connected with $V_1$. Two walks are equivalent if one can be obtained by a cyclic rotation of the other, or by reversing the other. For example, walk $(1, 2, 3, 4)$ is equivalent to the walk $(2, 3, 4, 1)$. Simple closed loop is a set of equivalent walks. Mr. Malnar now asks for your help in calculating the confusion of this city!

입력

In the first line is an integer $N$ (1ドル ≤ N ≤ 2 \cdot 10^5$), number of interesting locations.

In the next $N - 3$ lines are integers $X_i,ドル $Y_i$ (1ドル ≤ X_i , Y_i ≤ N$), labels of locations connected by $i$-th street.

출력

In the first and only line output the confusion of the given city modulo 10ドル^9 + 7$.

제한

서브태스크

번호배점제한
113

$N ≤ 15$

218

$N ≤ 300$

334

$N ≤ 2000$

415

Locations 1ドル$ and $k$ are connected for all $k = 3, 4, \dots , N - 1$.

540

No additional constraints.

예제 입력 1

4
1 3

예제 출력 1

3

On the sketch, each loop is colored in a different color.

예제 입력 2

5
1 3
3 5

예제 출력 2

6

Walks that represent loops are: $(1, 2, 3),ドル $(1, 3, 5),ドル $(3, 4, 5),ドル $(1, 2, 3, 5),ドル $(1, 3, 4, 5),ドル $(1, 2, 3, 4, 5)$.

예제 입력 3

6
2 4
4 6
6 2

예제 출력 3

11

Walks that represent loops are: $(1, 2, 6),ドル $(2, 3, 4),ドル $(4, 5, 6),ドル $(2, 4, 6),ドル $(1, 2, 4, 6),ドル $(2, 3, 4, 6),ドル $(2, 4, 5, 6),ドル $(1, 2, 3, 4, 6),ドル $(2, 3, 4, 5, 6),ドル $(1, 2, 4, 5, 6),ドル $(1, 2, 3, 4, 5, 6)$.

힌트

출처

Contest > Croatian Open Competition in Informatics > COCI 2024/2025 > Contest #1 5번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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