結果
問題 | No.2500 Products in a Range |
ユーザー |
|
提出日時 | 2023-10-13 22:29:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 2,068 ms |
コンパイル使用メモリ | 172,524 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-15 18:14:23 |
合計ジャッジ時間 | 4,375 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 WA * 9 |
ソースコード
#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=0;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){mx=max(mx,j-i+1-s);}else{s++;}}}cout << mx << endl;return 0;}