Universal Cup Judging System

Universal Cup

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

길이가 $N$인 양의 정수열 $A = (A_1, A_2, \dots, A_N)$이 주어집니다.

다음 조건을 모두 만족하는 부분집합 $X, Y \subseteq \{1, 2, \dots, N\}$가 존재하는지 판별하고, 존재한다면 그중 한 예를 출력하세요.

  • $0 < |X| = |Y|$
  • $X$와 $Y$는 집합으로서 서로 다릅니다
  • $s_X = \sum_{x \in X} \frac{1}{A_x}$이고 $s_Y = \sum_{y \in Y} \frac{1}{A_y}$라고 합시다. 이때 $|s_X - s_Y| \le 10^{-5}$이 성립합니다.

입력

입력은 다음 형식으로 주어집니다:

N
A1 A2 ... AN
  • 모든 입력값은 정수입니다.
  • $2 \le N \le 1000$
  • $1 \le A_i \le 10^5$

출력

조건을 만족하는 부분집합 $X, Y$가 존재하지 않으면 No를 출력합니다.

존재한다면 $M = |X| = |Y|$라고 합시다. $X$의 원소를 오름차순으로 나열한 것을 $X_1, X_2, \dots, X_M$, $Y$의 원소를 오름차순으로 나열한 것을 $Y_1, Y_2, \dots, Y_M$이라고 할 때, 다음 형식으로 출력합니다:

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

조건을 만족하는 쌍 $X, Y$가 여러 개 존재한다면 그중 아무것이나 하나를 출력해도 됩니다.

예제

입력 1

10
31 41 59 26 53 58 97 93 23 84

출력 1

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

입력 2

7
2 3 5 7 11 13 17

출력 2

No

입력 3

8
123 456 789 314 159 265 271 828

출력 3

Yes
4
2 4 5 7
1 2 3 6

노트

첫 번째 예제에서 $s_X = \frac{1}{31} + \frac{1}{59} = 0.04920721705\dots$이고 $s_Y = \frac{1}{26} + \frac{1}{93} = 0.04921422663\dots$이므로, $|s_X - s_Y| \le 10^{-5}$이 성립합니다.

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.