/ SeriousOJ /

Record Detail

Compile Error

foo.cc:7:10: fatal error: Ash.cpp: No such file or directory
    7 | #include "Ash.cpp"
      |          ^~~~~~~~~
compilation terminated.

Code

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

#ifndef ONLINE_JUDGE
#include "Ash.cpp"
#else
#define dbg(...)
#define dbgA(...)
#endif

const int N = 1e6 + 10;
vector<bool> yo(N, true);
vector<int> primes;

void sieve() {
  yo[0] = yo[1] = false;
  for (int i = 2; i * i < N; i++) {
    if (yo[i]) {
      for (int j = i * i; j < N; j += i) {
        yo[j] = false;
      }
    }
  }
  primes.push_back(2);
  for (int i = 3; i < N; i += 2) {
    if (yo[i]) {
      primes.push_back(i);
    }
  }
}
bool isprime(int x) { return yo[x]; }

void solve(int cs) {
  sieve();
  map<int, int> cnt;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (isprime(x)) {
      cnt[x] += 1;
    } else {
      for (auto &p : primes) {
        if (p > x)
          break;
        while (x % p == 0) {
          x /= p;
          cnt[p] += 1;
        }
      }
      if (x > 1) {
        cnt[x] += 1;
      }
    }
  }
  int res = 1;
  const int mod = 1e9 + 7;
  for (auto &[_, cc] : cnt) {
    res = res * 1LL * (cc + 1) % mod;
  }
  cout << res << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  // cin >> tc;
  for (int cs = 1; cs <= tc; cs++) {
    solve(cs);
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1060 Divisor
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-10 13:32:45
Judged At
2024-11-11 03:28:15
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes