結果
| 問題 |
No.3253 Banned Product
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 21:53:39 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,141 bytes |
| コンパイル時間 | 4,035 ms |
| コンパイル使用メモリ | 275,896 KB |
| 実行使用メモリ | 15,944 KB |
| 最終ジャッジ日時 | 2025-09-05 21:53:47 |
| 合計ジャッジ時間 | 7,166 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 1 TLE * 1 -- * 5 |
ソースコード
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
void solve() {
int n, k;
cin >> n >> k;
if (n == k) {
cout << -1 << endl;
return;
}
if (k <= (n-1)/k) {
cout << n << endl;
return;
}
do {
int x = n;
for (int d = 2; d*d <= x && d < k; ++d) {
if (x%d == 0) {
while(x%d == 0) x /= d;
}
}
if (x > k) {
cout << n << endl;
return;
}
} while(n--);
}
int main() {
int t;
cin >> t;
while(t--) solve();
return 0;
}