結果
問題 |
No.3248 構築問題
|
ユーザー |
|
提出日時 | 2025-08-29 21:40:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,259 bytes |
コンパイル時間 | 2,053 ms |
コンパイル使用メモリ | 203,192 KB |
実行使用メモリ | 42,616 KB |
最終ジャッジ日時 | 2025-08-29 21:40:49 |
合計ジャッジ時間 | 6,641 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 RE * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template <class T> bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template <class T> bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; namespace cho { std::vector<int> prime_table(int n) { std::vector<int> p(n + 1, -1); for (int i = 2; i * i <= n; i++) { if (p[i] != -1) continue; for (int j = i * i; j <= n; j += i) { p[j] = i; } } return p; } std::map<int, int> table_factor(int n) { const static std::vector<int> table = prime_table(1e7); assert(n <= 1e7); std::map<int, int> res; while (n > 1) { if (table[n] == -1) { res[n]++; break; } res[table[n]]++; n /= table[n]; } return res; } } // namespace cho void solve() { ll n, x; cin >> n >> x; auto mp = cho::table_factor(n); for (auto [a, k] : mp) { if (k < x) continue; ll b = n / (ll)pow(a, x); if (a != b) { cout << "Yes\n"; return; } } cout << "No\n"; } int main() { int t = 1; // cin >> t; while (t--) solve(); }