結果
問題 |
No.2500 Products in a Range
|
ユーザー |
|
提出日時 | 2023-10-14 00:19:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 4,087 ms |
コンパイル使用メモリ | 254,016 KB |
最終ジャッジ日時 | 2025-02-17 07:42:51 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 WA * 9 |
ソースコード
#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; } 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; }; ll ans=1; rep(i,n){ ll mn=a.at(i); ll mx=a.at(i); for(int j=i+1;j<n;j++){ if(isok(mn*a.at(j))&&isok(mx*a.at(j))){ chmax(ans,j-i+1); mx=a.at(j); }else break; } } cout<<ans<<endl; }