結果

問題 No.190 Dry Wet Moist
ユーザー TawaraTawara
提出日時 2015-12-20 12:40:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 408 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 7,076 KB
実行使用メモリ 32,440 KB
最終ジャッジ日時 2023-10-17 14:12:35
合計ジャッジ時間 6,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,840 KB
testcase_01 AC 12 ms
6,840 KB
testcase_02 AC 12 ms
6,840 KB
testcase_03 AC 13 ms
6,844 KB
testcase_04 AC 13 ms
6,844 KB
testcase_05 AC 13 ms
6,844 KB
testcase_06 AC 12 ms
6,840 KB
testcase_07 AC 15 ms
7,092 KB
testcase_08 AC 13 ms
7,036 KB
testcase_09 AC 13 ms
6,912 KB
testcase_10 AC 13 ms
6,904 KB
testcase_11 AC 13 ms
6,912 KB
testcase_12 AC 170 ms
17,504 KB
testcase_13 AC 213 ms
18,696 KB
testcase_14 AC 165 ms
17,320 KB
testcase_15 AC 231 ms
18,780 KB
testcase_16 AC 293 ms
20,360 KB
testcase_17 AC 46 ms
9,396 KB
testcase_18 AC 139 ms
16,808 KB
testcase_19 AC 289 ms
20,592 KB
testcase_20 AC 200 ms
18,064 KB
testcase_21 AC 33 ms
7,876 KB
testcase_22 AC 317 ms
24,184 KB
testcase_23 AC 408 ms
32,440 KB
testcase_24 AC 372 ms
24,200 KB
testcase_25 AC 12 ms
6,840 KB
testcase_26 AC 12 ms
6,840 KB
testcase_27 AC 257 ms
20,424 KB
testcase_28 AC 119 ms
16,696 KB
testcase_29 AC 146 ms
17,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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())
0