P1193 Luogu Team Training vs Traditional Team Training
Background
“In the field of secondary-school informatics education, [Luogu](/) is undoubtedly a very popular auxiliary website. At the same time, more than one hundred schools are using Luogu for informatics competitions (hereafter referred to as OI). The reason Luogu is so popular is that it innovatively moves almost every step of OI education online. Both school coaches and students can use this one website to practice and improve their skills.”
— From “Xiamen Primary and Secondary Education Science Research,” February 2015 issue.
Description
Two coaches of the informatics group at XX Middle School are debating whether the school’s informatics group should adopt Luogu as the primary training tool. They decide to use a quantitative approach to decide whether to switch.
The school’s original training method is as follows: on the teacher’s machine in the computer room, use cena to load the testdata. Loading the data takes time $T_a$, and this must be done for each problem. After a student finishes writing code, they can go to the teacher’s machine to submit and evaluate the program. However, because of the round trip, each evaluation incurs a waste of time $T_b$. Therefore, students are also allowed to load the testdata on their own machines, and they can choose which problems to load as needed. This takes the same time $T_a$ as loading on the teacher’s machine, but the time spent per evaluation is reduced to $T_c$. In addition, the school may use Excel to record each student’s training progress. If a student’s score on a problem is higher than the score recorded in the sheet, it will take time $T_d$ to update that record; otherwise no time is spent. If the student has not previously submitted that problem, the recorded score is considered to be $0$.
With Luogu, you only need to upload the problems and testdata to Luogu, taking time $T_a$. Each evaluation then takes only time $T_c$. Recording scores? That’s Luogu’s job—once a submission is completed, the platform organizes the table for you, taking no time.
It seems this could save quite a bit of time... However, the coach who supports the traditional method argues that Luogu is not $100 \%$ stable and may be unavailable in some cases. Therefore, first divide Luogu’s total time by its availability (a number less than $100 \%$, denoted $A\%$) and remove the fractional part. Furthermore, because traditional perceptions are hard to change and there is always distrust in handing problem data to Luogu (kkksc03: “Blame me?”), add a penalty time $H$ to Luogu’s total for a fair comparison.
Given the school’s training scenario, please help the two coaches analyze which choice to make.
Input Format
- The first line contains two integers $N, M$, the number of problems and the number of students.
- The second line contains $N$ integers $P_1, P_2, \ldots, P_N$, the problem IDs involved.
- The third line contains $M$ integers $S_1, S_2, \ldots, S_M$, the student IDs.
- The fourth line contains seven integers $T_a, T_b, T_c, T_d, A, H, E$. The meanings of the first six numbers are as described above. If $E$ is $1$, scores are recorded in Excel; if $E$ is $0$, they are not recorded.
- The fifth line contains a single integer $R$, the number of evaluations.
- The next $R$ lines each contain an evaluation record, with $\mathit{Pr}_i, \mathit{Sr}_i, \mathit{Sc}_i$ denoting the problem ID, the student ID, and the score for that evaluation, respectively.
Output Format
Output three lines.
- The first line is the total time for the traditional method.
- The second line is the total time for using Luogu, including the penalty time.
- The third line is the conclusion. If the time using Luogu is less than the time for the traditional method, output `Use Luogu!`. Otherwise, output `Forget it...`.
Explanation/Hint
【Sample Explanation #1】
Using the traditional method, loading $4$ problems takes $4 \times 50 = 200$. For students No. $2$ and No. $7$, the times to use the teacher’s machine are $30 \times 3 = 90$ and $30 \times 4 = 120$, respectively. However, clearly loading cena locally costs only $50 + 10 \times 3 = 80$ and $50 + 10 \times 4 = 90$, which are better. Students No. $3$ and No. $5$ should just use the teacher’s machine, costing $60$ and $30$. Student No. $2$’s first two evaluations are strictly increasing, so recording takes an extra $2 \times 5 = 10$ time. Student No. $3$ is too weak and always gets $0$, so no need to record. Students No. $5$ and No. $7$ each incur $5$. Therefore, the total time is $200 + 80 + 90 + 60 + 30 + 10 + 5 + 5 = 480$.
Using Luogu, uploading the problems takes $200$. The $10$ evaluations cost $10 \times 10 = 100$. Considering availability, the time is $$(200+100) / 93\% = 322,$$ so the final total time is $322 + 50 = 372$. Therefore, choose Luogu.
Constraints
- In $50\%$ of the testdata, Excel score recording is not required.
- In $50\%$ of the testdata, both problem IDs and student IDs are between $0$ and $1000$, inclusive.
(These two cases may overlap.)
- For $100\%$ of the testdata, it is guaranteed that $1 \le N, M \le 1000$, $1 \le T_a, T_b, T_c, T_d, H \le 10000$, $1 \le R < 100000$, $0 \le \mathit{Sc}_i \le 100$, $1 \le A \le 100$, and student IDs and problem IDs are less than $10^8$.
In fact, according to the certificate issued by Supervision, Luogu’s reliability (SLA) for Q1 2015 was $99.36 \%$. Also, perceptions can be changed.
Many of Luogu’s advantages are not quantifiable. Its essence lies in the community. Isn’t it great to learn and communicate with OIers nationwide?
One last note: last year’s “[Squeeze kkksc03]” notice is still valid; see details.
Translated by ChatGPT 5