Problem G for Train 2
Задачу добавил: elena
Успешно сдано решений: 15
Problem G. Going to be a programmer?
Author: A. Klenin
Input file: input.txt Time limit: 2 sec
Output file: output.txt Memory limit: 64 Mb
Statement
Igor is a computer science freshman student. As opposed to most of his classmates, he actually knows a little about computer programming. Because of this, other students often ask him to write their homework assignments for the "Introductory Programming" course.
He noticed that, although each assignment is unique, they usually follow a simple pattern. In particular, one assignment states:
"Count the number of integers in the array which are [greater than|less than|equal to|not equal to] [value]",
where parts in brackets differ from student to student. Assignments also contain sample input and output to encourage students to test their programs before submission.
Igor have many classmates, so to save time he decided to write a homework generator. He started with the following template:
count := 0;
for i := 1 to N do
if a[i] #cond# #value# then
Inc(count);
And now he wants to substitute #cond# and #value# based on the sample input from the assignment. Of course, generated program might be different from what was required in the assignment, but at least it would pass the sample test — his classmates are grateful to have even that. Do you know enough Introductory Programming to help Igor?
Your program will be given sample input — an array of N integer values, and the corresponding output R. It must find such substitution strings for #cond# and #value# that after execution of the code snippet above count will be equal to R, or determine that it is impossible.
Input file format
Input file contains integer N followed by N integers ai and then by integer R.
Output file format
The first line of output must contain one of the strings '<', '>', '=', '<>' — substitution for #cond#. The second line must contain an integer — substitution for #value#.
If there is no solution, output file must contain a single character '?' (ASCII 63). If there is more then one solution, output any of them.
Constraints
1 <= N <= 100, 0 <= R <= N, -10^6 <= ai <= 10^6.
Sample tests
Sample input 1
3
10 20 30
2
Sample output 1
>
15
Sample input 2
3
1 1 1
2
Sample output 2
?