Equal Product SOLUTION
You are given four numbers n, m, l and r. How about we name a tuple (x1,y1,x2,y2) as great if:
1≤x1<x2≤n;
1≤y2<y1≤m;
x1⋅y1=x2⋅y2;
l≤x1⋅y1≤r.
Locate any great tuple for each x1 from 1 to n comprehensive.
Info
The principal line contains two whole numbers n and m (1≤n,m≤2⋅105).
The subsequent line contains two numbers l and r (1≤l≤r≤nm).
Yield
For each x1 from 1 to n comprehensive:
in the event that there are no such four numbers, print −1;
something else, print four whole numbers x1, y1, x2 and y2. On the off chance that there are different answers, print any of them.
Models
input
8 20
91 100
output
– 1
– 1
– 1
– 1
– 1
6 16 8 12
– 1
– 1
input
4 5
1 10
output
1 2 1
2 3 2
– 1
– 1
input
5 12
16 60
output
– 1
2 9 3 6
3 8 4 6
4 5 4
– 1
We are Live Join Us
Check Your Mails