結果
| 問題 | No.3832 Coprime Arithmetic Progression |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-29 14:34:22 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 79 ms / 2,000 ms |
| + 663µs | |
| コード長 | 1,124 bytes |
| 記録 | |
| コンパイル時間 | 2,450 ms |
| コンパイル使用メモリ | 338,060 KB |
| 実行使用メモリ | 9,860 KB |
| 最終ジャッジ日時 | 2026-11-29 14:34:32 |
| 合計ジャッジ時間 | 9,531 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define rep(i, s, t) for (ll i = (ll)s; i < (ll)(t); i++)
#define rrep(i, s, t) for (ll i = (ll)(t) - 1; i >= (ll)(s); i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template <class T1, class T2>
bool chmin(T1& x, T2 y) { return x > y ? (x = y, true) : false; }
template <class T1, class T2>
bool chmax(T1& x, T2 y) { return x < y ? (x = y, true) : false; }
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
using max_heap = priority_queue<T>;
void solve() {
ll N, D;
cin >> N >> D;
if (N <= 3) {
cout << "Yes\n";
} else {
ll d = 2;
while (D % d == 0 || gcd(D, d) != 1) d++;
if (N <= 2 * d - 1) cout << "Yes\n";
else cout << "No\n";
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(15);
srand(time(NULL));
int T;
cin >> T;
// T = 1;
while (T--) solve();
}