結果

問題 No.2379 Burnside's Theorem
ユーザー KoseTKoseT
提出日時 2023-07-14 21:32:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 5,887 ms
コンパイル使用メモリ 201,536 KB
実行使用メモリ 5,300 KB
最終ジャッジ日時 2023-10-14 11:33:49
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 8 ms
5,192 KB
testcase_02 AC 8 ms
5,084 KB
testcase_03 AC 8 ms
5,300 KB
testcase_04 AC 9 ms
5,056 KB
testcase_05 AC 8 ms
5,136 KB
testcase_06 AC 8 ms
5,060 KB
testcase_07 AC 8 ms
5,172 KB
testcase_08 AC 8 ms
5,100 KB
testcase_09 AC 8 ms
5,056 KB
testcase_10 AC 8 ms
4,968 KB
testcase_11 AC 8 ms
5,036 KB
testcase_12 AC 8 ms
5,056 KB
testcase_13 AC 8 ms
5,000 KB
testcase_14 AC 8 ms
4,996 KB
testcase_15 AC 8 ms
5,088 KB
testcase_16 AC 8 ms
4,980 KB
testcase_17 AC 8 ms
5,036 KB
testcase_18 AC 8 ms
4,988 KB
testcase_19 AC 8 ms
4,972 KB
testcase_20 AC 8 ms
4,960 KB
testcase_21 AC 9 ms
5,072 KB
testcase_22 AC 8 ms
4,984 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
 
using namespace std;

vector<long long> make_prime(const int& num) {
  vector<char> is_prime(num+1, 1);
  for (int i=2;i*i<=num;++i) {
    if (is_prime[i] == 0) continue;
    for (int j=i+i;j<=num;j+=i) is_prime[j] = 0;
  }
  vector<long long> prime;
  for (int i=2;i<=num;++i) if (is_prime[i] == 1) prime.push_back(i);
  return prime;
}

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

  long long n;
  cin >> n;
  vector<long long> prime = make_prime(1001001);
  int cnt {};
  for (const auto& e : prime) {
    if (n % e == 0) {
      while (n % e == 0) n /= e;
      ++cnt;
    }
  }
  if (cnt == 2 && n == 1) cout << "No\n";
  else if (cnt < 2) cout << "Yes\n";
  else cout << "No\n";
}
0