E. TheBigFatDuck equal to TheHamster

    传统题 1000ms 256MiB

TheBigFatDuck equal to TheHamster

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Background

In the first three semesters, TheBigFatDuck and TheHamster achieved an equal first place in GPA in the 21 Grade of Information Security. They plan to maintain this status until the end, so that the school's academic affairs office can issue two academic achievement certificates for being ranked first in the program. This will help them secure admission to equally better universities for their postgraduate studies.

Description

After conducting research, TheBigFatDuck and DaddyCheng discovered that each teacher's grading follows the following rules:

  • Because of the similar levels of TheBigFatDuck and TheHamster, each teacher gives them a base points of 9090.
  • Teachers are sympathetic. In order to maintain balance, they give more points to the disadvantaged one. We quantify the sympathy level of each teacher as ai (1ai10)a_i\ (1\le a_i \le 10).
    • If the GPA of TheBigFatDuck is less than or equal to TheHamster's, the teacher will give sympathy points to TheBigFatDuck, i.e. TheBigFatDuck receives 90+ai90 + a_i points while TheHamster receives 9090 points.
    • Conversely, if the GPA of TheBigFatDuck is greater than TheHamster's, the teacher will give sympathy points to TheHamster, i.e. TheBigFatDuck receives 90 points while TheHamster receives 90+ai90 + a_i points.

If TheBigFatDuck and TheHamster have exactly the same curriculum, and we know their total GPA sums totsum, as well as the credits they have already earned is totcredit.

For each course this semester, we know the credit hours cic_i and the teacher's sympathy level aia_i.

Assuming that the order of the courses are randomly arranged, what is the probability that TheBigFatDuck get exactly the same GPA with TheHamster at the end of this semester? Output the result modulo 998244353.

Hint

To calculate the remainder of a fraction nm\dfrac{n}{m} with respect to pp, first, we need to find m1m^{-1} such that mm11(modp)mm^{-1}\equiv 1(\bmod p), then we have nm=n×m1(modp)\dfrac{n}{m} = n\times m^{-1}(\bmod p).

For each course:

Grade=points105Grade = \dfrac{points}{10} - 5

Assuming SS is all courses you had taken, we have:

Totsum=SGrade×CreditsTotsum=\sum_{S} Grade \times Credits $$GPA = \dfrac{\sum_{S}Grade\times Credit}{\sum_{S} Credit}=\dfrac{Totsum}{\sum_{S} Credit} $$

Format

Input

The first line contains 3 numbers n, totsum, totcredit.
n, totcredit are integers while totsum are decimal numbers rounded to one decimal place.
They represents the number of courses they are taking this semester, the total sums of both of them, the total credits they have in common.

The line 22 to the line n+1n+1 contains two integers each, ci,aic_i, a_i, representing the credit hours of the ii-th course and the sympathy level of the teacher for that course.

It is guaranteed that:

  • n100n \le 100
  • 0<totsum<10000 < totsum < 1000
  • 0<credit<4000 < credit < 400
  • 0ai1000 \le a_i \le 100
  • 1ci1001 \le c_i \le 100
  • 0ai×ci1000 \le a_i\times c_i \le 100

Output

An integer representing the probability that TheBigFatDuck tie with TheHamster at the end of this semester, modulo 998244353.

Sample

1 414 100
5 10
0
2 414 100
5 4
2 10
1

Limitation

1s,128MB


As he reached for his phone, a message caught his eye:

DaddyCheng: Why didn't you perform well this time, Yaya? /kel

TheBigFatDuck: well, if we can't make sure rank 1st, at least we can attend postgraduate studies together. In truth, I didn't have any specific aspirations; striving for a high GPA was simply a means to be attractive to the person I liked. DaddyCheng becoming the rank 1st was the most fitting outcome because DaddyCheng was truly outstanding and would represent us into higher educational institutions.

2023安徽大学ICPC集训队排位选拔赛 - Round1

未参加
状态
已结束
规则
ACM/ICPC
题目
6
开始于
2023-6-3 8:00
结束于
2023-6-3 12:00
持续时间
4 小时
主持人
参赛人数
29