結果

問題 No.190 Dry Wet Moist
ユーザー titiatitia
提出日時 2022-06-01 01:45:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 751 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 38,052 KB
最終ジャッジ日時 2023-10-21 00:45:48
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,152 KB
testcase_01 AC 25 ms
10,152 KB
testcase_02 AC 25 ms
10,152 KB
testcase_03 AC 24 ms
10,156 KB
testcase_04 AC 31 ms
10,156 KB
testcase_05 AC 28 ms
10,156 KB
testcase_06 AC 25 ms
10,152 KB
testcase_07 WA -
testcase_08 AC 27 ms
10,300 KB
testcase_09 AC 27 ms
10,232 KB
testcase_10 WA -
testcase_11 AC 28 ms
10,232 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 279 ms
34,244 KB
testcase_23 AC 401 ms
38,052 KB
testcase_24 AC 244 ms
31,900 KB
testcase_25 AC 27 ms
10,152 KB
testcase_26 AC 25 ms
10,152 KB
testcase_27 WA -
testcase_28 AC 115 ms
18,060 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N=int(input())
A=list(map(int,input().split()))

MINUS=[]
ZERO=0
PLUS=[]

for a in A:
    if a<0:
        MINUS.append(-a)
    elif a==0:
        ZERO+=1
    else:
        PLUS.append(a)

CM=Counter(MINUS)
CP=Counter(PLUS)

mans=0

for cp in CP:
    mans+=min(CP[cp],CM[cp])

mans+=ZERO//2

wans=0

M2=MINUS[:]
P2=PLUS[:]

M2.sort()
P2.sort()

ind=0
for i in range(len(M2)):
    while ind<len(P2) and P2[ind]<=M2[i]:
        ind+=1
    if ind<len(P2):
        wans+=1
        ind+=1

wans+=(len(P2)-wans)//2

#print(wans)

dans=0

ind=0
for i in range(len(P2)):
    while ind<len(M2) and M2[ind]<=P2[i]:
        ind+=1
    if ind<len(M2):
        dans+=1
        ind+=1

dans+=(len(M2)-dans)//2

print(dans,wans,mans)
0