結果
問題 | No.2500 Products in a Range |
ユーザー |
|
提出日時 | 2023-10-13 23:24:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 173,248 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 19:16:23 |
合計ジャッジ時間 | 3,739 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 61 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int,int> P;#define REP(i,n) for(ll i=0;i<ll(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++){vector<ll> v;v.push_back(a[i]);for(j=i+1;j<n;j++){ll R=max(a[i]*a[j],a[j]*v.back());ll L=min(a[i]*a[j],a[j]*v.back());if(r>=R && l<=L){v.push_back(a[j]);}}ll m=v.size();mx=max(mx,m);}cout << mx << endl;return 0;}