結果
| 問題 | No.190 Dry Wet Moist |
| コンテスト | |
| ユーザー |
Tawara
|
| 提出日時 | 2015-12-20 12:40:50 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 200 ms / 2,000 ms |
| コード長 | 512 bytes |
| 記録 | |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 77,612 KB |
| 最終ジャッジ日時 | 2025-12-03 18:46:52 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
from collections import Counter N = input() D=[];W=[];M=Nd=Nw=0 def solve(A,B,Na,Nb): cnt = inc = 0 for a in A: while inc < Nb and a <= B[inc]: inc+=1 if inc >= Nb:continue cnt+=1;inc+=1 Na -= cnt return cnt + min(Na,M) + max(0,Na-M)/2 for a in map(int,raw_input().split()): if a < 0: D+=[-a];Nd+=1 elif a > 0: W+=[a];Nw+=1 else: M += 1 D.sort(reverse=True) W.sort(reverse=True) Cd = Counter(D) Cw = Counter(W) print solve(D,W,Nd,Nw),solve(W,D,Nw,Nd),M/2+sum(min(v,Cw[k]) for k,v in Cd.iteritems())
Tawara