#P1193. Training Time Optimization
Training Time Optimization
Training Time Optimization
Two coaches at XX Middle School are debating whether to adopt Luogu as the main training tool for their information group. They decide to compare the total training time of the traditional method and using Luogu to make the decision.
The traditional method works as follows. For a given problem, students may choose between:
- Teacher Machine mode: Data is loaded for every run, taking time \(T_a\), and each evaluation run takes an extra time \(T_b\). Thus, for n submissions, the total running time is \(n\times(T_a+T_b)\).
- Local Machine mode: A student may pre-load the test data on his own computer, which takes time \(T_a\) once, after which each evaluation run costs \(T_c\). So the running time is \(T_a+n\times T_c\).
In addition, the school maintains an Excel record for each problem. Initially the recorded score is 0. For each submission, if the score is higher than the current record, an update is required and takes extra time \(T_d\). The number of updates is equal to the number of times a submission's score exceeds all previous scores.
Thus, the total traditional time is calculated as:
[ \text{TraditionalTime} = \min(n\times(T_a+T_b),,T_a+n\times T_c) + (\text{number of updates})\times T_d. ]
On the other hand, when using Luogu, the procedure is slightly different. The test data is uploaded once (taking \(T_a\) time) and each evaluation run costs \(T_c\) time. No Excel updating is needed. However, because of potential instability, the measured time is adjusted. The effective time is given by:
[ \text{LuoguTime} = \left\lfloor \frac{T_a+n\times T_c}{A/100} \right\rfloor + H, ]
where \(A\) is the system availability percentage (a number less than 100) and \(H\) is an additional penalty time.
Your task is: given the parameters and the scores of the submissions for one problem, determine which method is better. Print "Traditional" if the traditional method takes less time, "Luogu" if Luogu is faster, or "Tie" if both methods take exactly the same total time.
inputFormat
The input is given as follows:
T_a T_b T_c T_d H A n s_1 s_2 ... s_n
Where:
- \(T_a, T_b, T_c, T_d, H\) and \(A\) are positive integers. \(A\) represents the percentage (e.g., 90 means 90%).
- \(n\) is the number of submissions.
- Each \(s_i\) (\(1 \le i \le n\)) is the score of the i-th submission. Initially, the Excel record is 0.
outputFormat
Print a single line containing either "Traditional", "Luogu", or "Tie" depending on which method yields a lower total time.
sample
10 20 5 3 15 90
3
10 5 15
Traditional