Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

題目描述

考慮平面上的 $n$ 個整點,其中 $n$ 是 $3$ 的倍數。這些點的 $x$ 座標是 $1$ 到 $n$ 的一個排列,$y$ 座標也是 $1$ 到 $n$ 的一個排列。

請構建一個由 $n/3$ 個三角形組成的配置,其頂點為給定的這些點:每個點必須恰好作為其中一個三角形的頂點。三角形可以退化,並且可以自由相交。

一個配置的分數是其中所有三角形大小的總和。一個三角形的大小定義為它的邊界矩形的周長。邊界矩形是包含該三角形且邊平行於座標軸的最小矩形。

求一個能獲得最大可能分數的配置。

輸入格式

第一行包含一個整數 $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.