There is an inter-city math competition among kk various prestigious top schools in the city. Some subset of schools will be selected to compete, where the ii-th school is selected with probability pi(mod998 244 353)pi(mod998 244 353). The schools are all selected independently from each other. It’s even possible that the number of selected schools will be 00 or 11, because the contest organizers are not very good mathematicians themselves.
Once the schools have been selected, each selected school must choose rr of its students to form a team. The ii-th school has aiai students in total it can choose from. Given a selection of the schools, you are interested in the number of ways teams can be formed. Two ways are considered different if there is at least one school that chose different sets of students for its team.
If the subset of schools is chosen according to the above process, find the expected number of ways they can form teams.
For the work from home Internship Programs : Click here to apply now
- The first line contains an integer rr.
- The second line contains an integer kk.
- The third line contains kk integers a1,…,aka1,…,ak.
- The fourth line contains kk integers p1,…,pkp1,…,pk.
Output the expected number of ways to form teams, modulo 998244353998244353.
- 1≤pi<998 244 3531≤pi<998 244 353
Subtask 1 (10 points): r≤100r≤100
Subtask 2 (90 points): Original constraints.
1 2 2 2 1 1
Due to copyright issues we won't be able to update the solution here immediately. However you can download the code file from our telegram channel. So join our telegram channel for further updates. Keep tracking, the solution will be updated on this website soon.
- HACKEREARTH IS HIRING FOR INTERN || APPLY NOW
- INTEL IS HIRING FOR SOFTWARE DEVELOPER INTERN || APPLY Now
- DATA SCIENCE INTERNSHIP | SONY RESEARCH INDIA || APPLY NOW
- Cognizant Hiring | Graduate Trainee | APPLY NOW
- Deloitte Hiring | QA- Senior Analyst | APPLY NOW
- IBM Hiring | Technical Support Associate | APPLY NOW
- CRED | Freshers Hiring | Backend developer | APPLY NOW
- Axis bank | Internship Opportunity | Young Bankers Program
Read more post Here