AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

FPC24-021.Curious Jury

Easy · 3 s · 256 MB

  • icpc
  • fpc
  • 2024

There are multiple ways to break ties based on submit time in competitive programming contests. In particular, the time penalty can either be the sum of all the times that you submit a correct solution (like in this contest!), or it can be the time that the last accepted submission of a team came in.

As a jury member of a prestigious team contest, you are really excited by “fixed points”. These are places in the scoreboard where the rank of a particular team is equal to their penalty time. Because all teams solved all problems, the rank of a team is equal to the number of teams who had a strictly lower penalty time + 1+~1+ 1.

For each team, you know the sum of submit times of submissions sss, and a last submit time lll. The contest consists of more than one problem, so it must hold that l<sl < sl<s for each team. Additionally, we assume that the sum of submit times does not exceed the number of teams.

For example, say the penalty times for teams A, B, and C are 111 minute, 222 minutes, and 111 minute, respectively. Teams A and C both share rank 111, because no other teams have a strictly lower penalty time. They both also have penalty time 111, so they both form a fixed point on the scoreboard. There are two other teams which have a strictly lower penalty time than team B, so team B has rank 333, and its penalty time is 222, so it does not constitute a fixed point. In this example, there are 222 fixed points.

For each team, you decide to arbitrarily pick between the two ways of calculating the penalty time, to make fixed points.

For a given way of picking the sum or last submit time for each team, define ggg as the number of fixed points the scoreboard has.

Find the sum of ggg over all ways of choosing penalty times.

Giriş formatı

The input consists of:

• One line with an integer nnn (2≤n≤2⋅1052 \leq n\leq 2\cdot10^52≤n≤2⋅105), the number of participating teams.

• nnn lines with two integers lll and sss (1≤l<s≤n1 \leq l < s \leq n1≤l<s≤n), the last submit time and the sum of submit times for a team.

Çıxış formatı

Output the sum of ggg, the number of fixed points, over all 2n2^n2n ways of choosing penalty times.

Because the answer can be huge, output the answer modulo the prime 109+710^9+7109+7.

Qeyd

Source: Freshmen Programming Contest 2024 · Author: Jeroen Op de Beek · License: CC BY-SA 4.0 · Original: https://fpc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 3 of the 37 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

3
1 2
2 3
1 3

Çıxış #1

16

Giriş #2

10
1 6
2 7
3 8
1 2
5 9
9 10
1 10
2 8
3 4
4 5

Çıxış #2

4752