permitted to alter the marks through the accompanying activity: Pick two particular integers I and j among 1 and n. Trade the marks of focuses I and j, lastly Draw the section between focuses I and j.
Correct answer will be upvoted else downvoted. Computer science.
You are permitted to alter the marks through the accompanying activity:
Pick two particular integers I and j among 1 and n.
Trade the marks of focuses I and j, lastly
Draw the section between focuses I and j.
A grouping of tasks is legitimate if in the wake of applying every one of the activities in the succession all together, the k-th point winds up having the name k for all k among 1 and n comprehensive, and the drawn sections don't meet each other inside. Officially, assuming two of the portions cross, they should do as such at a typical endpoint of the two sections.
Specifically, all drawn portions should be unmistakable.
Track down any legitimate arrangement of activities, or say that none exist.
Input
The main line contains an integer n (3≤n≤2000) — the number of focuses.
The I-th of the accompanying n lines contains three integers xi, yi, man-made intelligence (−106≤xi,yi≤106, 1≤
It is ensured that all focuses are unmistakable, no three focuses are collinear, and the marks a1,a2,… ,a structure a change of 1,2,… ,n.
Output
In case it is difficult to play out a substantial arrangement of activities, print −1.
In any case, print an integer k (0≤k≤n(n−1)2) — the number of activities to perform, trailed by k lines, each containing two integers I and j (1≤i,j≤n, i≠j) — the lists of the focuses picked for the activity.
Step by step
Solved in 4 steps with 1 images