結果

問題 No.2379 Burnside's Theorem
ユーザー kpinkcatkpinkcat
提出日時 2023-10-03 01:08:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,097 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 201,688 KB
実行使用メモリ 11,140 KB
最終ジャッジ日時 2023-10-03 01:08:06
合計ジャッジ時間 5,261 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 9 ms
6,036 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 9 ms
6,256 KB
testcase_20 AC 15 ms
8,984 KB
testcase_21 AC 23 ms
11,136 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 23 ms
11,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:39:13: 警告: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
   39 |     for (ll i = p + 1; i < pow(n, 0.5); i++){
      |             ^
main.cpp:15:11: 備考: ‘p’ はここで定義されています
   15 |     ll n, p, t;
      |           ^

ソースコード

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, 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){
        cout << "Yes" << endl;
        return 0;
    }
    for (ll i = p + 1; i < pow(n, 0.5); i++){
        if ((is_prime[i] = 1) && !(n%i)){
            p = i;
            while (n){
                if (!(n%p)) n /= p;
                else break;
            }
            break;
        }
    }
    if (n == 1){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}
0