結果
| 問題 | No.3253 Banned Product |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 22:02:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,129 bytes |
| 記録 | |
| コンパイル時間 | 1,086 ms |
| コンパイル使用メモリ | 208,892 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-14 15:25:42 |
| 合計ジャッジ時間 | 5,129 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 -- * 6 |
ソースコード
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define dl double
#define st first
#define nd second
#define II pair <int, int>
using namespace std;
const int N = 5 + 1e5;
const int inf = 7 + 1e9;
void solve() {
int n, k;
cin >> n >> k;
if (n == k) {
cout << "-1\n";
return;
}
ll spr = (ll)k * k;
if (spr < n) {
cout << n << '\n';
return;
}
while (n > 0) {
int ok = 1;
for (int i = 1; i * i <= n, i <= k; i ++)
if (n % i == 0) {
int x = n / i;
if (x <= k) {
ok = 0;
break;
}
}
if (ok) {
cout << n << '\n';
return;
}
n --;
}
cout << "-1\n";
}
int main() {
#define TASKNAME ""
ios_base :: sync_with_stdio (0);
cin.tie (0);
if ( fopen( TASKNAME ".inp", "r" ) ) {
freopen (TASKNAME ".inp", "r", stdin);
freopen (TASKNAME ".out", "w", stdout);
}
int t;
cin >> t;
while (t --)
solve();
return 0;
}