#P1193. 洛谷团队训练 VS 传统团队训练

洛谷团队训练 VS 传统团队训练

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 TaT_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 TbT_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 TaT_a as loading on the teacher’s machine, but the time spent per evaluation is reduced to TcT_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 TdT_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 00.

With Luogu, you only need to upload the problems and testdata to Luogu, taking time TaT_a. Each evaluation then takes only time TcT_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%100 \% stable and may be unavailable in some cases. Therefore, first divide Luogu’s total time by its availability (a number less than 100%100 \%, denoted A%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 HH 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,MN, M, the number of problems and the number of students.
  • The second line contains NN integers P1,P2,,PNP_1, P_2, \ldots, P_N, the problem IDs involved.
  • The third line contains MM integers S1,S2,,SMS_1, S_2, \ldots, S_M, the student IDs.
  • The fourth line contains seven integers Ta,Tb,Tc,Td,A,H,ET_a, T_b, T_c, T_d, A, H, E. The meanings of the first six numbers are as described above. If EE is 11, scores are recorded in Excel; if EE is 00, they are not recorded.
  • The fifth line contains a single integer RR, the number of evaluations.
  • The next RR lines each contain an evaluation record, with Pri,Sri,Sci\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....
4 4
501 502 503 504
2 3 5 7
50 30 10 5 93 50 1
10
501 2 10
501 2 80
501 2 70
502 3 0
502 3 0
504 5 100
503 7 0
503 7 0
503 7 0
503 7 10

480
372
Use Luogu!

2 3
101 102
1 2 3
70 60 50 1 80 100 0
6
101 1 100
101 2 100
101 3 100
102 1 100
102 2 100
102 3 100

500
650
Forget it...

Hint

【Sample Explanation #1】

Using the traditional method, loading 44 problems takes 4×50=2004 \times 50 = 200. For students No. 22 and No. 77, the times to use the teacher’s machine are 30×3=9030 \times 3 = 90 and 30×4=12030 \times 4 = 120, respectively. However, clearly loading cena locally costs only 50+10×3=8050 + 10 \times 3 = 80 and 50+10×4=9050 + 10 \times 4 = 90, which are better. Students No. 33 and No. 55 should just use the teacher’s machine, costing 6060 and 3030. Student No. 22’s first two evaluations are strictly increasing, so recording takes an extra 2×5=102 \times 5 = 10 time. Student No. 33 is too weak and always gets 00, so no need to record. Students No. 55 and No. 77 each incur 55. Therefore, the total time is 200+80+90+60+30+10+5+5=480200 + 80 + 90 + 60 + 30 + 10 + 5 + 5 = 480.

Using Luogu, uploading the problems takes 200200. The 1010 evaluations cost 10×10=10010 \times 10 = 100. Considering availability, the time is $$(200+100) / 93% = 322,$$ so the final total time is 322+50=372322 + 50 = 372. Therefore, choose Luogu.

Constraints

  • In 50%50\% of the testdata, Excel score recording is not required.
  • In 50%50\% of the testdata, both problem IDs and student IDs are between 00 and 10001000, inclusive. (These two cases may overlap.)
  • For 100%100\% of the testdata, it is guaranteed that 1N,M10001 \le N, M \le 1000, 1Ta,Tb,Tc,Td,H100001 \le T_a, T_b, T_c, T_d, H \le 10000, 1R<1000001 \le R < 100000, 0Sci1000 \le \mathit{Sc}_i \le 100, 1A1001 \le A \le 100, and student IDs and problem IDs are less than 10810^8.

In fact, according to the certificate issued by Supervision, Luogu’s reliability (SLA) for Q1 2015 was 99.36%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