結果

問題 No.190 Dry Wet Moist
ユーザー convexineqconvexineq
提出日時 2020-12-17 18:30:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 114,600 KB
最終ジャッジ日時 2023-10-21 07:02:26
合計ジャッジ時間 4,964 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
63,232 KB
testcase_01 AC 49 ms
63,232 KB
testcase_02 AC 50 ms
63,232 KB
testcase_03 AC 48 ms
63,232 KB
testcase_04 AC 50 ms
63,232 KB
testcase_05 AC 48 ms
63,232 KB
testcase_06 AC 48 ms
63,232 KB
testcase_07 AC 57 ms
67,952 KB
testcase_08 AC 51 ms
65,280 KB
testcase_09 AC 51 ms
65,280 KB
testcase_10 AC 48 ms
63,232 KB
testcase_11 AC 49 ms
65,280 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 152 ms
111,676 KB
testcase_23 AC 161 ms
111,788 KB
testcase_24 AC 162 ms
114,600 KB
testcase_25 WA -
testcase_26 AC 49 ms
63,232 KB
testcase_27 AC 128 ms
97,996 KB
testcase_28 AC 91 ms
85,688 KB
testcase_29 AC 101 ms
89,444 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