結果

問題 No.190 Dry Wet Moist
ユーザー TawaraTawara
提出日時 2015-12-20 13:05:22
言語 Python2
(2.7.18)
結果
AC  
実行時間 488 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 7,128 KB
実行使用メモリ 32,152 KB
最終ジャッジ日時 2023-10-17 14:13:03
合計ジャッジ時間 5,466 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,916 KB
testcase_01 AC 13 ms
6,916 KB
testcase_02 AC 13 ms
6,916 KB
testcase_03 AC 12 ms
6,920 KB
testcase_04 AC 12 ms
6,920 KB
testcase_05 AC 13 ms
6,920 KB
testcase_06 AC 13 ms
6,916 KB
testcase_07 AC 16 ms
7,164 KB
testcase_08 AC 14 ms
7,112 KB
testcase_09 AC 14 ms
6,992 KB
testcase_10 AC 13 ms
6,976 KB
testcase_11 AC 14 ms
6,992 KB
testcase_12 AC 214 ms
17,620 KB
testcase_13 AC 264 ms
18,508 KB
testcase_14 AC 204 ms
17,600 KB
testcase_15 AC 282 ms
18,620 KB
testcase_16 AC 356 ms
20,260 KB
testcase_17 AC 54 ms
9,488 KB
testcase_18 AC 162 ms
17,064 KB
testcase_19 AC 347 ms
20,312 KB
testcase_20 AC 238 ms
18,292 KB
testcase_21 AC 37 ms
8,148 KB
testcase_22 AC 384 ms
24,260 KB
testcase_23 AC 488 ms
32,152 KB
testcase_24 AC 439 ms
24,276 KB
testcase_25 AC 13 ms
6,916 KB
testcase_26 AC 13 ms
6,916 KB
testcase_27 AC 301 ms
19,940 KB
testcase_28 AC 140 ms
16,704 KB
testcase_29 AC 177 ms
17,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter as C
N=input()*2;D=[];W=[]
def f(A,B,n,m):
	c=i=0
	for a in A:
		while i<m and a>=B[i]:i+=1
		if i^m:c+=1;i+=1
	n-=c
	return c+min(n,N)+max(0,n-N)/2
for a in map(int,raw_input().split()):D+=[a]*(a<0);W+=[-a]*(a>0)
D.sort();W.sort();d=len(D);w=len(W);N-=d+w;E=C(D);X=C(W)
print f(D,W,d,w),f(W,D,w,d),N/2+sum(min(E[k],X[k]) for k in E)
0