Universal Cup Judging System

Universal Cup

Süre Sınırı: 2.0 s Bellek Sınırı: 1024 MB Toplam puan: 100 Hack'lenebilir ✓
İstatistikler

문제 설명

평면 위의 $n$개의 정수 점을 생각해 봅시다. 여기서 $n$은 $3$으로 나누어떨어집니다. $x$좌표들은 $1$부터 $n$까지의 정수의 순열이고, $y$좌표들 또한 $1$부터 $n$까지의 정수의 순열입니다.

주어진 점들을 꼭짓점으로 하는 $n/3$개의 삼각형으로 이루어진 배치를 구성하세요. 각 점은 반드시 삼각형 중 하나의 꼭짓점으로 등장해야 합니다. 삼각형은 퇴화할 수 있으며 자유롭게 교차할 수 있습니다.

배치의 점수는 그 안에 포함된 모든 삼각형의 크기의 합입니다. 삼각형의 크기란 그 최소 경계 직사각형(bounding rectangle)의 둘레의 길이입니다. 최소 경계 직사각형이란 변이 좌표축에 평행하면서 해당 삼각형을 포함하는 가장 작은 직사각형을 말합니다.

가능한 최대 점수를 달성하는 배치를 찾으세요.

입력

첫 번째 줄에 정수 $n$ ($3 \le n \le 99\,999$; $n$은 $3$의 배수)이 주어집니다.

다음 $n$개의 줄에는 각각 두 정수 $x$와 $y$가 주어지며, 이는 점 하나의 좌표를 나타냅니다. $1$부터 $n$까지의 각 정수는 $x$좌표 중에서 한 번, $y$좌표 중에서 한 번 등장합니다.

출력

첫 번째 줄에 가능한 최대 점수를 출력하세요.

그다음, 이 점수를 달성하는 아무 배치나 출력하세요. 이를 위해 각 줄마다 세 개의 정수를 포함하는 $n/3$개의 줄을 출력하세요. 각 줄의 세 정수는 하나의 삼각형의 꼭짓점을 이루는 입력 점들의 번호입니다. 점들은 입력 순서대로 $1$부터 $n$까지 번호가 매겨져 있습니다. 삼각형들과 각 삼각형의 꼭짓점들은 어떤 순서로 출력해도 됩니다.

예제

6
6 5
3 6
5 3
2 4
1 1
4 2
32
2 3 5
6 1 4

노트

problem_17172_187b4365a0de3832ff3c189274998f76.png

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1223EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.