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.