結果
| 問題 | No.3832 Coprime Arithmetic Progression |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-28 01:24:09 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 71 ms / 2,000 ms |
| + 82µs | |
| コード長 | 2,629 bytes |
| 記録 | |
| コンパイル時間 | 4,600 ms |
| コンパイル使用メモリ | 379,468 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-11-28 01:24:20 |
| 合計ジャッジ時間 | 10,934 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 |
ソースコード
/*
酒飲んでアホですごいぜ
*/
#include <bits/stdc++.h>
using namespace std;
//高速化
struct ponjuice{ponjuice(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}}PonJuice;
#define endl '\n' //インタラクティブ問題の時は消す
//型
using ll = long long;
using ld = long double;
// for文
#define overload4(a, b, c, d, e, ...) e
#define rep1(n) for(ll i = 0; i < n; i++)
#define rep2(i, n) for(ll i = 0; i < n; i++)
#define rep3(i, a, b) for(ll i = a; i < b; i++)
#define rep4(i, a, b, step) for(ll i = a; i < b; i+= step)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define per1(n) for(ll i = n-1; i >= 0; i--)
#define per2(i, n) for(ll i = n-1; i >= 0; i--)
#define per3(i, a, b) for(ll i = b-1; i >= a; i--)
#define per4(i, a, b, step) for(ll i = b-1; i >= a; i-= step)
#define per(...) overload4(__VA_ARGS__, per4, per3, per2, per1)(__VA_ARGS__)
//関数
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<class S, class T>inline bool chmax(S& a, T b){return a < b && ( a = b , true);}
template<class S, class T>inline bool chmin(S& a, T b){return a > b && ( a = b , true);}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a){
rep(i,0,a.size()) os << (i == 0 ? "" : " ") << a[i];
return os;
}
void dump(auto ...vs){
((cerr << vs << ' '), ...) << endl;
}
//定数
constexpr ll mod = 998244353;
constexpr ll minf=-(1<<29);
constexpr ll inf=(1<<29);
constexpr ll MINF=-(1LL<<60);
constexpr ll INF=(1LL<<60);
const int dx[4] ={-1, 0, 1, 0};
const int dy[4] ={ 0, 1, 0,-1};
const int dx8[8] ={-1,-1,-1, 0, 1, 1, 1, 0};
const int dy8[8] ={-1, 0, 1, 1, 1, 0,-1,-1};
void solve();
int main() {
int t = 1;
cin >> t;
while(t--) solve();
}
#include<atcoder/all>
using namespace atcoder;
using namespace internal;
void solve() {
ll n,d;
cin >> n >> d;
rep(i,2,100000) {
if(i*2 > n) break;
if(!is_prime_constexpr(i)) continue;
if(d % i != 0) {
cout << "No" << endl;
return;
}
}
cout << "Yes" << endl;
return;
// d は n/2 いかの全ての倍数でなければならない
}
/*
x は 1..n-1と素
d が pの倍数ならば mod p で 1 になるように X を取る
そうでないのであれば、mod p で d にすると gcdでp が入りにくくなる(2p <= n だとアウト
逆に 2p > n であるのであれば、pの倍数は A の中に 1 開始か現れず耐える
x+d は 1..n-2 と素
各素数に対して
*/