結果

問題 No.2500 Products in a Range
コンテスト
ユーザー Алексей Данилюк
提出日時 2023-10-13 21:11:18
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,178 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 994 ms
コンパイル使用メモリ 150,412 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-07-02 15:18:48
合計ジャッジ時間 3,002 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 59 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse4a,avx,avx2,popcnt,tune=native")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);}
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define mp make_pair
#define all(x) (x).begin(),(x).end()

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

ll floor_div(ll x, ll y) {
	assert(y != 0);
	if (y < 0) {
		y = -y;
		x = -x;
	}
	if (x >= 0) return x / y;
	return (x + 1) / y - 1;
}
ll ceil_div(ll x, ll y) {
	assert(y != 0);
	if (y < 0) {
		y = -y;
		x = -x;
	}
	if (x <= 0) return x / y;
	return (x - 1) / y + 1;
}

const int N = 5050;
int n;
ll a[N];
ll l, r;
int ans;

int main() {
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld%lld", &n, &l, &r);
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	sort(a, a + n);
	ans = 1;
	if (r < 0) {
		for (int i = 0; i < n; i++)
			for (int j = i + 1; j < n; j++) {
				ll x = a[i] * a[j];
				if (l <= x && x <= r)
					ans = 2;
			}
		printf("%d\n", ans);
		return 0;
	}
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++) {
			ll x = a[i] * a[i + 1];
			ll y = a[i] * a[j];
			ll z = a[j - 1] * a[j];
			if (min(x, min(y, z)) < l || max(x, max(y, z)) > r) continue;
			ans = max(ans, j - i + 1);
		}
	printf("%d\n", ans);

	return 0;
}
0