結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2022-06-01 01:45:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 751 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 38,532 KB |
最終ジャッジ日時 | 2024-09-21 01:26:29 |
合計ジャッジ時間 | 6,632 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 14 |
ソースコード
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)