

AntidoteIn the 23rd century a virus with the codename ECN2202 (Easy to Cure and Neutralize 2202) is making victims within the population. Mankind is heading towards social and economical disaster. A large research group is trying to find an antidote; they are using programming contests to find and run simulations of possibly good vaccines. The vaccine has two components: VacA and VacB. The research process results in n different VacA components and m different VacB components, described through their aggressiveness of the effect on the human organism. The components work in pairs, and every VacA is compatible with any of the VacB components, their aggressiveness is the cumulated aggressiveness of the two parts. The more aggressive the vaccine, the more effective it is. But too much aggressiveness can really hurt the body of the patient. After many discussions, the scientists came up with a testing plan. They decide to leave the least effective vaccines apart, and to do so with the most aggressive ones too. To set the range, they set a lower and an upper bound for the effectiveness, but given that there can be up to 200 000 different components which can be combined, they can only set theoretical bounds. According to this, only those vaccines are eligible for testing which are strictly more effective than the Ath element and strictly less aggressive than the Bth element in the list of (VacA, VacB) in increasing ordered list of the cumulative aggressiveness. Given the increasingly ordered list of VacA and VacB components, help them figure out which combinations are in the tolerable range of aggressiveness, not to make many casualties in the trial. Input SpecificationThe first line contains four spaceseparated integers: n is the cardinality of VacA components, m is the cardinality of VacB components, A is the index of the lower bound of the eligible combinations, B is the upper bound of the eligible combinations. The two indexes are considered in the increasing ordered list of all (VacA_{i}, VacB_{j}) combinations’ cumulated aggressiveness (1 ≤ i ≤ n, 1 ≤ j ≤ m). The next n lines contain the VacA components’ aggressiveness values as integers in increasing order. The next m lines contain the VacB components’ aggressiveness values as integers in increasing order. Output SpecificationThe first line of the output should contain K, the total number of eligible vaccines. The next K lines are formed by the index pairs of eligible (VacA_{i}, VacB_{j}) combinations, where the Ath element in the ordered list of combinations < (VacA_{i}, VacB_{j}), and (VacA_{i}, VacB_{j}) < the Bth element in the ordered list of combinations. The eligible vaccines are sorted by the first component, then, in case of equality, by the second component. Input Limits and Constraints
Sample Input
Output for Sample Input
ExplanationThe 2nd element in the ordered list of combinations is (1, 2), with a value of 1 + 3 = 4. The 5th element in the ordered list of combinations is (1, 5), with an effectiveness of 1 + 6 = 7. The only value between the two boundaries, which is strictly greater than 4 and strictly less than 8, is (1, 4) with an effectiveness value of 5. 

University of Debrecen; Faculty of Informatics; v. 03/01/2019 