結果

問題 No.190 Dry Wet Moist
ユーザー convexineqconvexineq
提出日時 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
64,784 KB
testcase_01 AC 46 ms
64,128 KB
testcase_02 AC 47 ms
63,196 KB
testcase_03 AC 46 ms
64,128 KB
testcase_04 AC 46 ms
63,832 KB
testcase_05 AC 46 ms
62,992 KB
testcase_06 AC 46 ms
63,996 KB
testcase_07 AC 53 ms
67,796 KB
testcase_08 AC 47 ms
65,204 KB
testcase_09 AC 47 ms
64,660 KB
testcase_10 AC 46 ms
65,228 KB
testcase_11 AC 46 ms
64,196 KB
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 144 ms
112,104 KB
testcase_23 AC 154 ms
112,272 KB
testcase_24 AC 157 ms
115,244 KB
testcase_25 WA -
testcase_26 AC 45 ms
63,996 KB
testcase_27 AC 120 ms
98,560 KB
testcase_28 AC 88 ms
85,976 KB
testcase_29 AC 94 ms
89,516 KB
権限があれば一括ダウンロードができます

ソースコード

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