Universal Cup Judging System

Universal Cup

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

Bạn được cho một dãy số nguyên dương $A = (A_1, A_2, \dots, A_N)$ có độ dài $N$.

Hãy xác định xem có tồn tại các tập con $X, Y \subseteq \{1, 2, \dots, N\}$ thỏa mãn tất cả các điều kiện sau hay không. Nếu tồn tại các tập con như vậy, hãy in ra một ví dụ.

  • $0 < |X| = |Y|$
  • $X$ và $Y$ là hai tập hợp khác nhau
  • Đặt $s_X = \sum_{x \in X} \frac{1}{A_x}$ và $s_Y = \sum_{y \in Y} \frac{1}{A_y}$. Khi đó $|s_X - s_Y| \le 10^{-5}$ được thỏa mãn.

Dữ liệu vào

Dữ liệu vào được cung cấp theo định dạng sau:

N
A1 A2 ... AN
  • Tất cả các giá trị đầu vào đều là số nguyên.
  • $2 \le N \le 1000$
  • $1 \le A_i \le 10^5$

Dữ liệu ra

Nếu không tồn tại các tập con $X, Y$ thỏa mãn điều kiện, hãy in ra No.

Nếu tồn tại, đặt $M = |X| = |Y|$. Gọi các phần tử của $X$ theo thứ tự tăng dần là $X_1, X_2, \dots, X_M$, và các phần tử của $Y$ theo thứ tự tăng dần là $Y_1, Y_2, \dots, Y_M$. Hãy in ra theo định dạng sau:

Yes
M
X1 X2 ... XM
Y1 Y2 ... YM

Nếu có nhiều cặp $X, Y$ hợp lệ, bạn có thể in ra bất kỳ cặp nào trong số đó.

Ví dụ

Đầu vào 1

10
31 41 59 26 53 58 97 93 23 84

Đầu ra 1

Yes
5
1 2 5 7 9
1 2 3 4 6

Đầu vào 2

7
2 3 5 7 11 13 17

Đầu ra 2

No

Đầu vào 3

8
123 456 789 314 159 265 271 828

Đầu ra 3

Yes
4
2 4 5 7
1 2 3 6

Ghi chú

Trong ví dụ đầu tiên, $s_X = \frac{1}{31} + \frac{1}{59} = 0.04920721705\dots$ và $s_Y = \frac{1}{26} + \frac{1}{93} = 0.04921422663\dots$, do đó $|s_X - s_Y| \le 10^{-5}$ được thỏa mãn.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1418EditorialOpen题解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.