Universal Cup Judging System

Universal Cup

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

มีจุด $N$ จุด ได้แก่ $p_1, p_2, \dots, p_N$ บนระนาบสองมิติ

จุด $p_i$ ตั้งอยู่ที่พิกัด $(X_i, Y_i)$ ไม่มีจุดสองจุดใดที่มีพิกัดเดียวกัน

จงสร้างการเรียงสับเปลี่ยน $q = (q_1, q_2, \dots, q_N)$ หนึ่งแบบของลำดับจุด $p = (p_1, p_2, \dots, p_N)$ ที่สอดคล้องกับเงื่อนไขต่อไปนี้ หรือระบุว่าเป็นไปไม่ได้

  • สำหรับทุก $1 \le i \le N - 2$ จุดสามจุด $q_i, q_{i+1}, q_{i+2}$ ตามลำดับนี้จะต้องอยู่บนเส้นตรงเดียวกัน หรือไม่ก็เลี้ยวในทิศทางทวนเข็มนาฬิกา
    • กล่าวให้ชัดเจนยิ่งขึ้นคือ ให้พิกัดของ $q_i$ เป็น $(x_i, y_i)$ เงื่อนไขต่อไปนี้จะต้องเป็นจริง: $(x_{i+1} - x_i)(y_{i+2} - y_{i+1}) - (y_{i+1} - y_i)(x_{i+2} - x_{i+1}) \ge 0$

จงแก้ปัญหานี้สำหรับชุดข้อมูลทดสอบ $T$ ชุด

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะให้มาในรูปแบบต่อไปนี้:

T
case1
case2
:
caseT

แต่ละชุดข้อมูลทดสอบจะให้มาในรูปแบบต่อไปนี้:

N
X1 Y1
X2 Y2
:
XN YN
  • $1 \le T \le 100$
  • $3 \le N \le 3000$
  • $0 \le X_i, Y_i \le 10^9$
  • $(X_i, Y_i) \ne (X_j, Y_j)$ ($i \ne j$)
  • ผลรวมของ $N$ จากทุกชุดข้อมูลทดสอบไม่เกิน $3000$
  • ค่าข้อมูลนำเข้าทั้งหมดเป็นจำนวนเต็ม

ข้อมูลส่งออก

พิมพ์ $T$ บรรทัด

สำหรับบรรทัดที่ $i$ หากไม่มี $q$ ที่สอดคล้องกับเงื่อนไขสำหรับชุดข้อมูลทดสอบที่ $i$ ให้พิมพ์ $-1$

มิฉะนั้น ให้ $q = (p_{r_1}, p_{r_2}, \dots, p_{r_N})$ จงแสดงผล $r_1, r_2, \dots, r_N$ ตามลำดับนี้ คั่นด้วยช่องว่าง

หากมีคำตอบที่ถูกต้องหลายแบบ คุณสามารถแสดงคำตอบใดก็ได้

ตัวอย่าง

ข้อมูลนำเข้า 1

1
9
2 4
2 3
2 2
1 1
4 4
4 3
5 2
5 1
6 5

ข้อมูลส่งออก 1

6 9 2 3 5 1 8 7 4

หมายเหตุ

problem_17421_1.png

รูปที่ 1: คำอธิบายสำหรับตัวอย่าง

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1485EditorialOpen题解jianglyView
#1343EditorialOpen题解MilmonView

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.