結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2022-06-01 01:50:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 469 ms / 2,000 ms |
コード長 | 808 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 38,420 KB |
最終ジャッジ日時 | 2024-09-21 01:26:35 |
合計ジャッジ時間 | 5,491 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
from collections import CounterN=int(input())A=list(map(int,input().split()))MINUS=[]ZERO=0PLUS=[]for a in A:if a<0:MINUS.append(-a)elif a==0:ZERO+=1else:PLUS.append(a)CM=Counter(MINUS)CP=Counter(PLUS)mans=0for cp in CP:mans+=min(CP[cp],CM[cp])mans+=ZERO//2wans=0M2=MINUS+[0]*ZEROP2=PLUS[:]M2.sort()P2.sort()ind=0for i in range(len(M2)):while ind<len(P2) and P2[ind]<=M2[i]:ind+=1if ind<len(P2):wans+=1ind+=1wans+=(len(P2)-wans)//2#print(wans)dans=0M2=MINUS[:]P2=PLUS+[0]*ZEROM2.sort()P2.sort()ind=0for i in range(len(P2)):while ind<len(M2) and M2[ind]<=P2[i]:ind+=1if ind<len(M2):dans+=1ind+=1dans+=(len(M2)-dans)//2print(dans,wans,mans)