結果

問題 No.2379 Burnside's Theorem
ユーザー ManjushriMitra
提出日時 2024-08-10 18:53:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 2,742 ms
コンパイル使用メモリ 251,192 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-08-10 18:53:40
合計ジャッジ時間 3,697 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,m,n) for(int i=m; i<n; ++i)
#define repl(i,m,n) for(ll i=m; i<n; ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

int main(){
    ll N;
    cin >> N;
    if(N == 1LL){
        cout << "Yes" << endl;
    }else{
        map<ll, ll> mp;
        for(ll p = 2LL; p*p <= N; ++p){
            if(N % p != 0LL) continue;
            ll ex = 0LL;
            while(N % p == 0LL){
                N /= p;
                ex++;
            }
            mp[p] = ex;
        }
        if(N != 1LL) mp[N] = 1LL;

        cout << (mp.size() <= 2 ? "Yes" : "No") << endl;
    }
    return 0;
}
0