結果

問題 No.2500 Products in a Range
ユーザー baluteshih
提出日時 2023-10-13 21:10:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 196,736 KB
最終ジャッジ日時 2025-02-17 06:58:58
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(), v.end()
#define pb push_back

ll arr[10005];

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n;
    ll l, r;
    cin >> n >> l >> r;
    for (int i = 1; i <= n; ++i)
        cin >> arr[i];
    int ans = 1;
    sort(arr + 1, arr + n + 1);
    for (int i = 1; i <= n; ++i)
        arr[i + n] = arr[i];
    n += n;
    auto in_itv = [&](ll x) {
        return clamp(x, l, r) == x;
    };
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n && j - i + 1 <= n; ++j) {
            if (in_itv(arr[i] * arr[i + 1]) && in_itv(arr[i] * arr[j]) && in_itv(arr[j - 1] * arr[j]))
                ans = max(ans, j - i + 1);
            else
                break;
        }
    }
    cout << ans << "\n";
}
0