結果
問題 | No.2500 Products in a Range |
ユーザー |
|
提出日時 | 2023-10-13 22:31:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 2,156 ms |
コンパイル使用メモリ | 195,436 KB |
最終ジャッジ日時 | 2025-02-17 07:24:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 61 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main () {int N;ll L, R;cin >> N >> L >> R;ll A[5050];for (int i = 0; i < N; i ++) cin >> A[i];sort(A, A + N);int ans = 1;for (int l = 0; l < N - 1; l ++) {ll mi = A[l], ma = A[l];int n = 1;for (int r = l + 1; r < N; r ++) {ll x = A[r] * mi, y = A[r] * ma;bool ok = L <= min(x, y) && max(x, y) <= R;if (ok) {n ++;ma = A[r];}}ans = max(ans, n);}cout << ans << endl;}