結果

問題 No.2379 Burnside's Theorem
ユーザー hari64hari64
提出日時 2023-07-14 21:26:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 2,024 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 207,036 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 11:23:26
合計ジャッジ時間 2,883 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,356 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 7 ms
4,352 KB
testcase_14 AC 9 ms
4,348 KB
testcase_15 AC 10 ms
4,352 KB
testcase_16 AC 3 ms
4,352 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef hari64
#include <bits/stdc++.h>
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#define debug(...)
#else
#include "util/viewer.hpp"
#define debug(...) viewer::_debug(__LINE__, #__VA_ARGS__, __VA_ARGS__)
#endif
// clang-format off
using namespace std;
using ll = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<ll, ll>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vc<T>>;
template <typename T> using vvvc = vector<vvc<T>>;
using vi = vc<int>; using vl = vc<ll>; using vpi = vc<pii>; using vpl = vc<pll>;
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(), (x).rend()
constexpr int INF = 1001001001; constexpr long long INFll = 1001001001001001001;
template <class T> bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template <class T> bool chmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
// clang-format on

// O(NloglogN)
vector<int> prime_table(int n) {
    assert(n >= 1);
    if (n == 1) return {};
    vector<bool> isp((n + 1) >> 1, true);
    for (int i = 3; i < int(sqrt(n)) + 1; i += 2)
        if (isp[i >> 1])
            for (int j = i * i >> 1; j < int(isp.size()); j += i) isp[j] = false;
    vector<int> ret({2});
    for (int i = 1; i < (n + 1) >> 1; i++)
        if (isp[i]) ret.push_back((i << 1) + 1);
    return ret;
}

template <class T>  // O(√N)
vector<pair<T, T>> prime_factorize(T N) {
    vector<pair<T, T>> ret;
    for (T b = 2; b * b <= N; ++b) {
        if (N % b != 0) continue;
        T e = 0;
        while (N % b == 0) {
            e++;
            N /= b;
        }
        ret.push_back({b, e});
    }
    if (N != 1) ret.push_back({N, 1});
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    auto pf = prime_factorize(N);
    debug(pf);

    if (pf.size() <= 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}
0