結果

問題 No.2500 Products in a Range
ユーザー cho435cho435
提出日時 2023-10-13 23:17:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 875 bytes
コンパイル時間 5,928 ms
コンパイル使用メモリ 265,540 KB
実行使用メモリ 668,020 KB
最終ジャッジ日時 2023-10-13 23:18:04
合計ジャッジ時間 22,775 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,700 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 16 ms
6,700 KB
testcase_03 AC 3 ms
4,352 KB
testcase_04 AC 4 ms
5,248 KB
testcase_05 AC 9 ms
6,004 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 351 ms
64,676 KB
testcase_08 MLE -
testcase_09 AC 7 ms
5,904 KB
testcase_10 AC 1,687 ms
232,520 KB
testcase_11 TLE -
testcase_12 AC 758 ms
159,052 KB
testcase_13 AC 17 ms
11,988 KB
testcase_14 MLE -
testcase_15 AC 37 ms
18,080 KB
testcase_16 AC 228 ms
259,396 KB
testcase_17 AC 145 ms
173,948 KB
testcase_18 AC 154 ms
183,444 KB
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 33 ms
37,448 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
権限があれば一括ダウンロードができます

ソースコード

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++)

void chmax(ll &a,ll b){
	if(a<b) a=b;
}


ll op(ll a,ll b){
	return max(a,b);
}
ll e(){
	return -1;
}

using segtree = atcoder::segtree<ll,op,e>;

int main(){
	int n,l,r;
	cin>>n>>l>>r;
	vector<ll> a(n);
 	rep(i,n) cin>>a.at(i);
	sort(a.begin(),a.end());
	auto isok=[&](ll x){
		return l<=x&&x<=r;
	};
	vector<segtree> dp(n,segtree(n));
	rep(chs,n){
		dp.at(chs).set(chs,1);
		rep(i,chs){
			if(isok(a.at(i)*a.at(chs))){
				ll up=chs;
				ll dw=i;
				while(up-dw>1){
					ll md=(up+dw)/2;
					if(isok(a.at(md)*a.at(chs))) dw=md;
					else up=md;
				}
				ll g=dp.at(i).prod(i,up);
				if(dp.at(i).get(chs)<g+1) dp.at(i).set(chs,g+1);
			}
		}
	}
	ll ans=0;
	rep(i,n) rep(j,n){
		chmax(ans,dp.at(i).all_prod());
	}
	cout<<ans<<endl;
}
0