結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 8 ms
5,976 KB
testcase_04 RE -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 RE -
testcase_09 AC 2 ms
4,376 KB
testcase_10 RE -
testcase_11 AC 2 ms
4,380 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 9 ms
6,408 KB
testcase_20 AC 17 ms
8,916 KB
testcase_21 AC 30 ms
11,096 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 28 ms
11,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:39:13: 警告: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
   39 |     for (ll i = p + 1; i <= n; 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 <= n; 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