Universal Cup Judging System

Universal Cup

実行時間制限: 2.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓
統計

ישנן $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.