結果

問題 No.2379 Burnside's Theorem
ユーザー kpinkcatkpinkcat
提出日時 2023-10-03 01:21:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 200,208 KB
実行使用メモリ 11,284 KB
最終ジャッジ日時 2023-10-03 01:21:27
合計ジャッジ時間 3,254 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 9 ms
6,024 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 14 ms
7,268 KB
testcase_14 AC 19 ms
9,156 KB
testcase_15 AC 22 ms
10,616 KB
testcase_16 AC 3 ms
4,384 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 26 ms
11,040 KB
testcase_19 AC 9 ms
6,532 KB
testcase_20 AC 16 ms
8,956 KB
testcase_21 AC 24 ms
11,100 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 23 ms
11,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main(){
    ll n, p = 0, t;
    cin >> n;
    t = pow(n, 0.5);
    vector<ll> is_prime(t, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;

    for (ll i = 2; i < t; i++){
        for(ll j = i*i; j < t; j += i) is_prime[j] = 0;
    }
    for (ll i = 2; i < t; i++){
        if ((is_prime[i]) && !(n%i)){
            p = i;
            while (n){
                if (!(n%p)) n /= p;
                else break;
            }
            break;
        }
    }
    if (n == 1 || p == 0){
        cout << "Yes" << endl;
        return 0;
    }
    p = 0;
    for (ll i = p + 1; i <= pow(n, 0.5); i++){
        if ((is_prime[i]) && !(n%i)){
            p = i;
            while (n){
                if (!(n%p)) n /= p;
                else break;
            }
            break;
        }
    }
    if (n == 1 || p == 0){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}
0