結果

問題 No.2495 Three Sets
ユーザー cho435cho435
提出日時 2023-10-12 17:47:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 950 bytes
コンパイル時間 4,269 ms
コンパイル使用メモリ 262,596 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-12 17:47:48
合計ジャッジ時間 9,955 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 8 ms
4,352 KB
testcase_10 WA -
testcase_11 AC 7 ms
4,356 KB
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

int main(){
	int na,nb,nc;
	cin>>na>>nb>>nc;
	vector<int> a(na),b(nb),c(nc);
	rep(i,na) cin>>a.at(i);
	rep(i,nb) cin>>b.at(i);
	rep(i,nc) cin>>c.at(i);
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	reverse(c.begin(),c.end());
	vector<ll> sma(na+1);
	rep(i,na) sma.at(i+1)=sma.at(i)+a.at(i);
	ll ans=0;
	ll smb=0;
	rep(bb,nb+1){
	  ll smc=0;
		rep(cc,nc+1){
			int aa;
			if(bb==0) aa=na;
			else{
				auto itr=lower_bound(a.begin(),a.end(),-smc/bb,[&](int x,int y){
					return x > y;
				});
				aa=itr-a.begin();
			}
			ll tmp=sma.at(aa)*bb+smb*cc+smc*aa;
			ans=max(ans,tmp);
			if(cc==nc) break;
			smc+=c.at(cc);
		}
		if(bb==nb) break;
		smb+=b.at(bb);
	}
	cout<<ans<<endl;
}
0