結果
問題 |
No.3248 構築問題
|
ユーザー |
|
提出日時 | 2025-08-29 22:03:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 993 bytes |
コンパイル時間 | 2,245 ms |
コンパイル使用メモリ | 198,812 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-08-29 22:03:27 |
合計ジャッジ時間 | 2,701 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 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; ll lpow(ll a, ll x) { ll res = 1; rep(i, 0, x) res *= a; return res; } void solve() { ll n, x; cin >> n >> x; if (x == 1) { cout << "Yes\n"; return; } map<int, int> mp; { ll cn = n; for (ll i = 2; i * i <= cn; i++) { while (cn % i == 0) { mp[i]++; cn /= i; } } if (cn > 1) mp[cn]++; } for (auto [a, k] : mp) { if (k < x) continue; ll b = n / lpow(a, x); if (a != b) { cout << "Yes\n"; return; } } cout << "No\n"; } int main() { int t = 1; // cin >> t; while (t--) solve(); }