FPC22-020.Cake Promise
Easy · 2 s · 256 MB
- icpc
- fpc
- 2022
Today is the big day: professor P. Wright is organizing a programming contest. All of his students are participating, because he has promised to bake a cake for all teams that can beat him in the contest. ( All characters and events in this problem description are fictional. Any resemblance to actual lecturers is purely coincidental. ) After the contest has ended, professor Wright receives a raw copy of the scoreboard, in which the teams are out of order. He is short on time: besides baking, he also has some exams to grade. Therefore, he needs a program to calculate how many teams beat him in the contest.
The contest consists of a given number of problems, which the teams will need to solve as fast as possible. One team beats another team if the number of problems solved by the first team is strictly greater. If the number of problems solved is equal between two teams, the team that required a lower sum of minutes to solve the problems beats the other. Professor Wright is also willing to bake a cake for teams that solved the same number of problems and required the same sum of minutes as himself.
Giriş formatı
The input consists of:
• One line containing two integers and (), the number of teams participating and the number of programming problems, respectively. Professor Wright counts as one of the teams.
• lines, each containing values, the results for each team. The first line represents the results of professor Wright. Each result is either “X”, indicating that the team did not solve this problem, or an integer (), representing the number of minutes that this team needed to solve the problem.
Çıxış formatı
Output the number of teams for which professor Wright needs to bake a cake.
Qeyd
Source: Freshmen Programming Contest 2022 · Author: Maarten Sijm · License: CC BY-SA 4.0 · Original: https://fpc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 6 of the 27 original test cases (the largest) are omitted here to keep the problem lightweight.
Nümunələr
Giriş #1
5 5 40 X 10 30 20 X X 20 50 40 50 40 20 30 10 X X 30 X 50 X 30 5 40 20
Çıxış #1
2
Giriş #2
4 4 4 5 6 X 4 5 X 5 4 X 5 6 X 4 5 7
Çıxış #2
2