結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2020-12-17 18:37:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 155 ms / 2,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 115,328 KB |
最終ジャッジ日時 | 2024-09-21 08:11:13 |
合計ジャッジ時間 | 3,803 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
n = int(input())*a, = map(int,input().split())N = 10**5+10pos = [0]*Nneg = [0]*Nfor i in a:if i >= 0: pos[i] += 1else: neg[-i] += 1moist = sum(min(i,j) for i,j in zip(pos,neg)) + pos[0]//2zero = pos[0]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 = 0res = 0for bi in b:while i < L and a[i] <= bi:i += 1if i < L and a[i] > bi:res += 1i += 1y = L-resreturn res + min(zero,y) + max((y-zero),0)//2print(get(neg,pos),get(pos,neg),moist)