結果

問題 No.190 Dry Wet Moist
ユーザー convexineq
提出日時 2020-12-17 18:30:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 115,244 KB
最終ジャッジ日時 2024-09-21 08:10:32
合計ジャッジ時間 4,845 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())

N = 10**5+1
pos = [0]*N
neg = [0]*N
for i in a:
    if i >= 0: pos[i] += 1
    else: neg[-i] += 1

moist = sum(min(i,j) for i,j in zip(pos,neg)) + pos[0]//2

pos = [ai for ai in a if ai >= 0]
neg = [-ai for ai in a if ai < 0]
pos.sort()
neg.sort()

def get(a,b):
    L = len(a)
    i = 0
    res = 0
    for bi in b:
        while i < L and a[i] <= bi:
            i += 1
        if i < L and a[i] > bi:
            res += 1
            i += 1
    
    return res + (L-res)//2
    
print(get(neg,pos),get(pos,neg),moist)
0