問題一覧 > 通常問題

No.190 Dry Wet Moist

レベル : / AI推定難易度 : 1350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 256 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 148
作問者 : 紙ぺーぱー
お気に入りにしたユーザー ProblemId : 499 / 自分の提出
問題文最終更新日: 2026-06-25 07:10:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 99 (順位表) の他の問題:

Problem Statement

kamipeipaa is a science student, so he loves experiments. Today he is conducting an experiment in which he combines two samples, each having some moisture.
kamipeipaa has $2N$ samples. The moisture of the $i$-th sample is represented by an integer $A_i$. He repeats the operation of choosing two of these samples and combining them $N$ times. The moisture of a combined substance is the sum of the moistures of the two samples used to make it. A combined substance is called $Dry$ if its moisture is negative, $Wet$ if it is positive, and $Moist$ if it is zero. Combined substances are dangerous, so they must not be used. Naturally, the samples used in a combination are consumed.

kamipeipaa is about to conduct the experiment, and he wonders how many $Dry$ substances, $Wet$ substances, and $Moist$ substances he can make at most as results of combining. Please tell him.

Input

$N$
$A_1$ $A_2$ $.$ $.$ $.$ $A_{2N}$

The first line contains an integer $N(1 \le N \le 10^{5})$ representing the number of combinations to perform. The second line contains space-separated integers $A_i(-10^{5} \le A_i \le 10^{5})$ representing the moisture of the samples.

Output

Output on one line, separated by spaces, the maximum number of $Dry$ substances, $Wet$ substances, and $Moist$ substances that can be made among the resulting combined substances.

Sample

Sample 1
Input
4
-4 -3 -2 -1 1 2 3 4
Output
3 3 4

If you combine as (-4, 3), (-3, 2), (-2, 1), (-1, 4), you can make 3 $Dry$ substances. If you combine as (-3, 4), (-2, 3), (-1, 2), (-4, 1), you can make 3 $Wet$ substances. If you combine as (-4, 4), (-3, 3), (-2, 2), (-1, 1), you can make 4 $Moist$ substances.

Sample 2
Input
2
1 2 3 4
Output
0 2 0

No matter how you combine them, you can only make $Wet$ substances.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。