結果

問題 No.2500 Products in a Range
ユーザー umimelumimel
提出日時 2023-10-13 21:51:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,312 bytes
コンパイル時間 1,792 ms
コンパイル使用メモリ 171,956 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-13 21:51:34
合計ジャッジ時間 4,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 8 ms
4,352 KB
testcase_08 AC 31 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 26 ms
4,348 KB
testcase_11 AC 33 ms
4,348 KB
testcase_12 AC 13 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 36 ms
4,352 KB
testcase_15 AC 3 ms
4,356 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 31 ms
4,348 KB
testcase_20 AC 35 ms
4,372 KB
testcase_21 AC 3 ms
4,348 KB
testcase_22 AC 38 ms
4,348 KB
testcase_23 AC 37 ms
4,372 KB
testcase_24 AC 37 ms
4,348 KB
testcase_25 AC 48 ms
4,348 KB
testcase_26 AC 47 ms
4,352 KB
testcase_27 AC 49 ms
4,348 KB
testcase_28 AC 29 ms
4,352 KB
testcase_29 AC 6 ms
4,352 KB
testcase_30 AC 5 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 12 ms
4,352 KB
testcase_34 AC 29 ms
4,352 KB
testcase_35 AC 1 ms
4,352 KB
testcase_36 AC 1 ms
4,352 KB
testcase_37 AC 2 ms
4,352 KB
testcase_38 AC 1 ms
4,368 KB
testcase_39 AC 1 ms
4,352 KB
testcase_40 AC 2 ms
4,352 KB
testcase_41 AC 2 ms
4,356 KB
testcase_42 AC 1 ms
4,352 KB
testcase_43 AC 1 ms
4,352 KB
testcase_44 AC 8 ms
4,356 KB
testcase_45 WA -
testcase_46 AC 16 ms
4,348 KB
testcase_47 AC 49 ms
4,348 KB
testcase_48 WA -
testcase_49 AC 1 ms
4,356 KB
testcase_50 AC 13 ms
4,352 KB
testcase_51 AC 15 ms
4,352 KB
testcase_52 AC 30 ms
4,348 KB
testcase_53 AC 5 ms
4,352 KB
testcase_54 AC 2 ms
4,352 KB
testcase_55 AC 17 ms
4,352 KB
testcase_56 AC 20 ms
4,352 KB
testcase_57 AC 30 ms
4,352 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const ll MOD1000000007 = 1000000007;
const ll MOD998244353 = 998244353;
const ll MOD[3] = {999727999, 1070777777, 1000000007};
const ll LINF = 1LL << 60LL;
const int IINF = (1 << 30) - 1;


void solve(){
    ll n, l, r; cin >> n >> l >> r;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    sort(all(a));

    ll ans = 1;

    for(ll i=0; i<n-1; i++) for(ll j=i+1; j<n; j++){
        if(l <= a[i]*a[j] && a[i]*a[j]>=r) ans = max(ans, 2LL);
        if(a[i]<=0 && a[j]<=0){
            if(l<=a[j-1]*a[j] && a[i]*a[i+1]<=r) ans = max(ans, j-i+1);
        }
        if(a[i]<=0 && a[j]>=0){
            if(l <= a[i]*a[j] && max(a[i]*a[i+1], a[j-1]*a[j]) <= r) ans = max(ans, j-i+1);
        }
        if(a[i]>=0 && a[j]>=0){
            if(l<=a[i]*a[i+1] && a[j-1]*a[j]<=r) ans = max(ans, j-i+1);
        }
    }

    cout << ans << endl;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int T=1;
    //cin >> T;
    while(T--) solve();
}
0