What Was My Rank??
Time limit1sMemory limit1024 MB
Given students' scores and some remembered grade orderings, decide for each query whether one student's final grade is higher, lower, equal, or undetermined.
Problem
The long second semester is almost over. Only the grade review period is left before the end of the term.
Students in the course "Algorithm Design and Analysis" know their assignment score , midterm score , and final exam score . Each student's final grade is computed as follows, using three positive integers , , and that give the weight of each score.
This semester, to encourage everyone to do their best on every exam and assignment, the weights , , and will not be published. So it matters that students write down the final grade shown during the grade review period.
Excited about the upcoming break, the students did not check their grades properly and forgot their own final grades. Later, when they became curious, they tried to check again, but it was hopeless.
Luckily, some students remember a classmate whose final grade was higher than their own. Use this information to estimate your own final grade. Write a program that answers questions about which of two students has the higher final grade.
Input
The first line contains the number of students , the number of remembered comparisons , and the number of queries . (, )
Each of the next lines contains the integers , , and for one student. ()
Each of the next lines contains integers and , meaning that student had a higher final grade than student . (, )
Each of the next lines contains integers and , asking which of student and student has the higher final grade. (, )
The input is always valid.
Output
Print lines. For each query with and , print > if student has a higher final grade than student , < if student has a lower final grade, = if they are equal, and ? if the result cannot be determined.