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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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≤ai≤n), addressing that the I-th point has arranges (xi,yi) and at first has mark simulated intelligence. 

 

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.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education