結果

問題 No.2495 Three Sets
ユーザー 👑 p-adicp-adic
提出日時 2023-09-05 18:22:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,877 ms / 3,000 ms
コード長 624 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 106,992 KB
最終ジャッジ日時 2023-09-06 08:27:03
合計ジャッジ時間 11,622 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,164 KB
testcase_01 AC 83 ms
76,572 KB
testcase_02 AC 85 ms
76,348 KB
testcase_03 AC 81 ms
76,300 KB
testcase_04 AC 83 ms
76,076 KB
testcase_05 AC 84 ms
76,292 KB
testcase_06 AC 84 ms
76,552 KB
testcase_07 AC 84 ms
76,396 KB
testcase_08 AC 86 ms
76,492 KB
testcase_09 AC 96 ms
77,252 KB
testcase_10 AC 97 ms
76,864 KB
testcase_11 AC 126 ms
77,832 KB
testcase_12 AC 144 ms
77,712 KB
testcase_13 AC 1,628 ms
88,308 KB
testcase_14 AC 1,728 ms
99,796 KB
testcase_15 AC 1,432 ms
87,032 KB
testcase_16 AC 1,834 ms
106,992 KB
testcase_17 AC 1,877 ms
106,920 KB
testcase_18 AC 79 ms
76,152 KB
testcase_19 AC 135 ms
104,372 KB
testcase_20 AC 133 ms
103,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

R=range
I=lambda:list(map(int,input().split()))
N=I()
B=3000
W=6002
L=[]
S=[]
U=[]
C=[B]
for n in R(3):
	S+=[[0]]
	U+=[[0]]
	L+=[1]
	X=I()
	A={-B:0}
	for x in X:A[-x]=A[-x]+1if -x in A else 1
	for a in sorted(A):
		S[n]+=[S[n][L[n]-1]+A[a]]
		U[n]+=[U[n][L[n]-1]-a*A[a]]
		if n>1:C+=[-a]
		L[n]+=1
X=[]
for x in R(W):
	a=l=0
	r=L[2]
	while l+1<r:
		m=(l+r)//2
		if C[m]>=x-B:l=m
		else:r=m
	X+=[l]
for i in R(L[0]):
	for j in R(L[1]):
		if U[1][j]+B*S[0][i]>=0:
			if S[0][i]<1:m=L[2]-1
			else:
				r=max(0,-(U[1][j]//S[0][i])+B)
				m=[0,X[r]][r<W]
			if m:a=max(a,U[0][i]*S[1][j]+U[1][j]*S[2][m]+U[2][m]*S[0][i])
print(a)
0