RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0602

Mooball Teams III

Diamond IV 다이아몬드 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John has \(N\) cows on his farm (\(2 \leq N \leq 2\cdot 10^5\)), conveniently
numbered \(1 \dots N\). Cow \(i\) is located at integer coordinates \((x_i, y_i)\)
(\(1\le x_i,y_i\le N\)). Farmer John wants to pick two teams for a game of
mooball!

One of the teams will be the "red" team; the other team will be the "blue" team.
There are only a few requirements for the teams. Neither team can be empty, and
each of the \(N\) cows must be on at most one team (possibly neither). The only
other requirement is due to a unique feature of mooball: an infinitely long net,
which must be placed as either a horizontal or vertical line in the plane at a
non-integer coordinate, such as \(x = 0.5\). FJ must pick teams so that it is
possible to separate the teams by a net. The cows are unwilling to move to make
this true.

Help a farmer out! Compute for Farmer John the number of ways to pick a red team
and a blue team satisfying the above requirements, modulo \(10^9+7\).

Problem credits: Dhruv Rohatgi

제약

SCORING

  • Input 5: \(N\le 10\)
  • Inputs 6-9: \(N\le 200\)
  • Inputs 10-13: \(N\le 3000\)
  • Inputs 14-24: No additional constraints.

Problem credits: Dhruv Rohatgi

입력 형식

The first line of input contains a single integer \(N.\)

The next \(N\) lines of input each contain two space-separated integers \(x_i\) and
\(y_i\). It is guaranteed that the \(x_i\) form a permutation of \(1\dots N\), and
same for the \(y_i\).

출력 형식

A single integer denoting the number of ways to pick a red team and a blue team
satisfying the above requirements, modulo \(10^9+7\).

예제 1
입력
2
1 2
2 1
출력
2
설명

We can either choose the red team to be cow 1 and the blue team to be cow 2, or
the other way around. In either case, we can separate the two teams by a net
(for example, \(x=1.5\)).

예제 2
입력
3
1 1
2 2
3 3
출력
10
설명

Here are all ten possible ways to place the cows on teams; the \(i\)th character
denotes the team of the \(i\)th cow, or . if the \(i\)th cow is not on a team.

RRB
R.B
RB.
RBB
.RB
.BR
BRR
BR.
B.R
BBR
예제 3
입력
3
1 1
2 3
3 2
출력
12
설명

Here are all twelve possible ways to place the cows on teams:

RRB
R.B
RBR
RB.
RBB
.RB
.BR
BRR
BR.
BRB
B.R
BBR
예제 4
입력
40
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
출력
441563023
설명

Make sure to output the answer modulo \(10^9+7\).

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2023-2024 > January > Platinum

태그

평가 및 의견

Mooball Teams III

개요
출제자 난이도 Diamond IV 다이아몬드 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Mooball Teams III

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8