結果

問題 No.2500 Products in a Range
ユーザー daiotadaiota
提出日時 2023-10-13 22:53:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 172,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 18:38:50
合計ジャッジ時間 4,337 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j,k;

	ll n,l,r;
	cin >> n >> l >> r;

	vector<ll> a(n);
	for(i=0;i<n;i++) cin >> a[i];

	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());

	ll mx=1;
	for(i=0;i<n-1;i++){
		ll L=2e18,R=-2e18,s=1;
		for(j=i+1;j<n;j++){
			R=max({R,a[i]*a[i+1],a[j]*a[j-1]});
			L=min({L,a[i]*a[j],a[j]*a[j-1]});

			if(r>=R && l<=L){
				s++;
			}
		}

		mx=max(mx,s);
	}

	cout << mx << endl;


	return 0;
}
0