結果

問題 No.190 Dry Wet Moist
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-29 01:28:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 126,136 KB
最終ジャッジ日時 2024-04-15 01:03:40
合計ジャッジ時間 4,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
54,588 KB
testcase_01 AC 40 ms
53,944 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 40 ms
53,928 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 42 ms
55,360 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 197 ms
122,196 KB
testcase_23 AC 215 ms
126,136 KB
testcase_24 RE -
testcase_25 AC 40 ms
54,788 KB
testcase_26 AC 41 ms
54,900 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
pos = []
neg = []
for a in A:
    if a >= 0:
        pos.append(a)
    else:
        neg.append(a)


dry = 0
p = sorted(pos, reverse=True)
for n in sorted(neg, reverse=True):
    if p and n + p[-1] < 0:
        dry += 1
        p.pop()

wet = 0
p = sorted(pos)
for n in sorted(neg):
    if n + p[-1] > 0:
        wet += 1
        p.pop()
while len(p) >= 2:
    if p.pop() + p.pop() > 0:
        wet += 1

moist = 0
p = Counter(pos)
n = Counter(neg)
for k, v in n.items():
    vv = p[-k]
    moist += min(v, vv)
moist += p[0] // 2

print(dry, wet, moist)
0