problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define mp make_pair #define fi first #define se second #define VAL 100000 #define ll long long int #define INF 10000000000000000LL #define pll pair<long long, long long> const int MAX = 1e7; const ll MOD = 1e18; const int TOT_PRIMES = 19; const int MAX_A = 70; ll dp[90000]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); ll n; cin >> n; ll cnt = 0; for (int i = 0; i < 100; i++) { for (int j = 0; j < i; j++) { dp[cnt] = i; cnt++; } } ll tot = 0; for (int i = 2; i * i <= n; i++) { ll u = 0; while (n % i == 0) { n = n / i; u++; } tot = tot + dp[u] - 1; } if (n > 1) tot += 1; cout << tot; }
#include <bits/stdc++.h> #define mp make_pair #define fi first #define se second #define VAL 100000 #define ll long long int #define INF 10000000000000000LL #define pll pair<long long, long long> const int MAX = 1e7; const ll MOD = 1e18; const int TOT_PRIMES = 19; const int MAX_A = 70; ll dp[90000]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); ll n; cin >> n; ll cnt = 0; for (int i = 0; i < 100; i++) { for (int j = 0; j < i; j++) { dp[cnt] = i; cnt++; } } ll tot = 0; for (ll i = 2; i * i <= n; i++) { ll u = 0; while (n % i == 0) { n = n / i; u++; } tot = tot + dp[u] - 1; } if (n > 1) tot += 1; cout << tot; }
replace
28
29
28
29
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i < (n + 1); ++i) const double PI = 3.141592653589793238463; using namespace std; using ll = long long; const ll INF = +10010010000; typedef pair<int, int> P; const int mod = 1e9 + 7; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { (x += a.x) %= mod; return *this; } mint &operator-=(const mint a) { (x -= mod - a.x) %= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t % 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { fact[0] = 1; for (int i = 1; i < n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] + ifact[n - k]; } }; int main() { ll n; cin >> n; vector<pair<int, int>> fn; for (int i = 2; i * i < n; i++) { int x = 0; while (n % i == 0) { n /= i; ++x; } fn.emplace_back(i, x); } if (n != 1) fn.emplace_back(n, 1); int ans = 0; rep(i, fn.size()) { int prime = fn[i].first; int cnt = fn[i].second; int x = 1; while (cnt - x >= 0) { cnt -= x; x++; ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i < (n + 1); ++i) const double PI = 3.141592653589793238463; using namespace std; using ll = long long; const ll INF = +10010010000; typedef pair<int, int> P; const int mod = 1e9 + 7; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { (x += a.x) %= mod; return *this; } mint &operator-=(const mint a) { (x -= mod - a.x) %= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t % 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { fact[0] = 1; for (int i = 1; i < n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] + ifact[n - k]; } }; int main() { ll n; cin >> n; vector<pair<int, int>> fn; for (int i = 2; (ll)i * i < n; i++) { int x = 0; while (n % i == 0) { n /= i; ++x; } fn.emplace_back(i, x); } if (n != 1) fn.emplace_back(n, 1); int ans = 0; rep(i, fn.size()) { int prime = fn[i].first; int cnt = fn[i].second; int x = 1; while (cnt - x >= 0) { cnt -= x; x++; ans++; } } cout << ans << endl; return 0; }
replace
78
79
78
79
TLE
p02660
C++
Time Limit Exceeded
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long long int i, j, k, n, b, ans = 0, po = 0; scanf("%lld", &n); for (i = 2; 1; i++) { po = 0; if (n % i == 0) { while (1) { if (n % i == 0) { n = n / i; po++; } else break; } for (j = 1; 1; j++) { if (po >= j) { po = po - j; ans++; } else break; } } if (n == 1) break; } printf("%lld", ans); }
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { long long int i, j, k, n, b, ans = 0, po = 0; scanf("%lld", &n); for (i = 2; 1; i++) { po = 0; if (n % i == 0) { while (1) { if (n % i == 0) { n = n / i; po++; } else break; } for (j = 1; 1; j++) { if (po >= j) { po = po - j; ans++; } else break; } } if (n == 1) break; if (i > 1000000) { ans += 1; break; } } printf("%lld", ans); }
insert
28
28
28
32
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { ll n; cin >> n; map<int, int> m; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { m[i]++; n /= i; } } if (n != 1) m[n] = 1; int ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { int num = itr->second; int count = 1; while (true) { num -= count; count++; if (num >= 0) ans++; else break; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { ll n; cin >> n; map<int, int> m; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { m[i]++; n /= i; } } if (n != 1) m[n] = 1; int ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { int num = itr->second; int count = 1; while (true) { num -= count; count++; if (num >= 0) ans++; else break; } } cout << ans << endl; }
replace
8
9
8
9
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vector<string> #define vpii vector<pii> #define vpll vector<pll> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++) #define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++) #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define RSORT(x) sort(rall(x)); #define pb push_back #define mp make_pair #define INF (1e9) #define PI (acos(-1)) #define EPS (1e-7) ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; } ull lcm(ull a, ull b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } map<int, int> mp; ll t = n; for (int i = 2; i <= sqrtl(t); ++i) { while (t % i == 0) { t /= i; mp[i]++; } if (t == 1) break; } if (t > 1) mp[t]++; priority_queue<ll, vll, greater<ll>> q; for (auto p : mp) { ll a = 1; rep(i, p.second) { a *= p.first; q.emplace(a); } } ll ans = 0; while (n > 1) { ll p = q.top(); q.pop(); if (p > n) break; if (n % p != 0) continue; n /= p; ++ans; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vector<string> #define vpii vector<pii> #define vpll vector<pll> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++) #define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++) #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define RSORT(x) sort(rall(x)); #define pb push_back #define mp make_pair #define INF (1e9) #define PI (acos(-1)) #define EPS (1e-7) ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; } ull lcm(ull a, ull b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } map<ll, int> mp; ll t = n; for (int i = 2; i <= sqrtl(t); ++i) { while (t % i == 0) { t /= i; mp[i]++; } if (t == 1) break; } if (t > 1) mp[t]++; priority_queue<ll, vll, greater<ll>> q; for (auto p : mp) { ll a = 1; rep(i, p.second) { a *= p.first; q.emplace(a); } } ll ans = 0; while (n > 1) { ll p = q.top(); q.pop(); if (p > n) break; if (n % p != 0) continue; n /= p; ++ans; } cout << ans << endl; return 0; }
replace
47
48
47
48
TLE
p02660
C++
Time Limit Exceeded
// g++ .cpp && ./a.out #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; vector<pair<ll, int>> factor(ll x) { vector<pair<ll, int>> res; for (int i = 2; i * i <= x; i++) { int cnt = 0; while (x % i == 0) x /= i, cnt++; if (cnt) res.emplace_back(i, cnt); } if (x != 1) res.emplace_back(x, 1); return res; } int main() { ll n; cin >> n; vector<pair<ll, int>> fs = factor(n); int ans = 0; for (pair<ll, int> p : fs) { // cout << p[i].first << ' ' << p[i].second << endl; int b = 1; int x = p.second; while (x >= b) { x -= b; b++; ans++; } } cout << ans << endl; }
// g++ .cpp && ./a.out #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; vector<pair<ll, int>> factor(ll x) { vector<pair<ll, int>> res; for (ll i = 2; i * i <= x; i++) { int cnt = 0; while (x % i == 0) x /= i, cnt++; if (cnt) res.emplace_back(i, cnt); } if (x != 1) res.emplace_back(x, 1); return res; } int main() { ll n; cin >> n; vector<pair<ll, int>> fs = factor(n); int ans = 0; for (pair<ll, int> p : fs) { // cout << p[i].first << ' ' << p[i].second << endl; int b = 1; int x = p.second; while (x >= b) { x -= b; b++; ans++; } } cout << ans << endl; }
replace
9
10
9
10
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < ((ll)(n)); i++) #define reg(i, a, b) for (ll i = ((ll)(a)); i <= ((ll)(b)); i++) #define irep(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--) #define ireg(i, a, b) for (ll i = ((ll)(b)); i >= ((ll)(a)); i--) template <class T = int> using V = vector<T>; template <class T = int> using VV = V<V<T>>; template <class T = int> void print(vector<T> v) { for (auto a : v) cout << a << " "; cout << endl; } /* */ ll n, ans = 0; int main(void) { cin >> n; for (int i = 2; i * i <= n; i++) { int c = 0; while (n % i == 0) { n /= i; c++; } // cerr<<i<<","<<c<<endl; for (int j = 1; j <= c; j++) { c -= j; ans++; } } if (n > 1) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < ((ll)(n)); i++) #define reg(i, a, b) for (ll i = ((ll)(a)); i <= ((ll)(b)); i++) #define irep(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--) #define ireg(i, a, b) for (ll i = ((ll)(b)); i >= ((ll)(a)); i--) template <class T = int> using V = vector<T>; template <class T = int> using VV = V<V<T>>; template <class T = int> void print(vector<T> v) { for (auto a : v) cout << a << " "; cout << endl; } /* */ ll n, ans = 0; int main(void) { cin >> n; for (ll i = 2; i * i <= n; i++) { int c = 0; while (n % i == 0) { n /= i; c++; } // cerr<<i<<","<<c<<endl; for (int j = 1; j <= c; j++) { c -= j; ans++; } } if (n > 1) ans++; cout << ans << endl; return 0; }
replace
22
23
22
23
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int ll; typedef pair<int, int> P; int main() { ll n; cin >> n; map<ll, int> mp; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { n /= i; mp[i]++; } } if (n != 1) mp[n]++; int ans = 0; for (auto x : mp) { int t = x.second; for (int i = 1; i < 100; i++) { if (i > t) break; ans++; t -= i; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int ll; typedef pair<int, int> P; int main() { ll n; cin >> n; map<ll, int> mp; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { n /= i; mp[i]++; } } if (n != 1) mp[n]++; int ans = 0; for (auto x : mp) { int t = x.second; for (int i = 1; i < 100; i++) { if (i > t) break; ans++; t -= i; } } cout << ans << endl; return 0; }
replace
11
12
11
12
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; constexpr auto INFI = 2147483647; const ll INFL = 9223372036854775807; int main() { ll n; cin >> n; ll start_n = n; ll ans = 0; for (int i = 2; (ll)(i * i) < start_n; i++) { if (n % i == 0) { int count = 0; while (n % i == 0) { count++; n /= i; } for (int j = 1; count > 0; j++) { if (count >= j) { count -= j; ans++; } else { break; } } } } if (n > 1) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; constexpr auto INFI = 2147483647; const ll INFL = 9223372036854775807; int main() { ll n; cin >> n; ll start_n = n; ll ans = 0; ll limit_i = (int)sqrt(n) + 1; for (int i = 2; i < limit_i; i++) { // if(n == 1) break; int count = 0; while (n % i == 0) { n /= i; count++; } int t = 1; while (count > 0) { count -= t; t++; if (count >= 0) ans++; ; } } if (n > 1) ans++; cout << ans << endl; return 0; }
replace
13
29
13
28
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <numeric> #include <utility> #include <vector> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (lhs < rhs) { lhs = rhs; return true; } return false; } struct range { struct itr { int64_t i; constexpr itr(int64_t i_) : i(i_) {} constexpr void operator++() { ++i; } constexpr int64_t operator*() const { return i; } constexpr bool operator!=(itr x) const { return i != x.i; } }; const itr l, r; constexpr range(int64_t l_, int64_t r_) : l(l_), r(std::max(l_, r_)) {} constexpr itr begin() const { return l; } constexpr itr end() const { return r; } }; struct revrange { struct itr { int64_t i; constexpr itr(int64_t i_) : i(i_) {} constexpr void operator++() { --i; } constexpr int64_t operator*() const { return i; } constexpr bool operator!=(itr x) const { return i != x.i; } }; const itr l, r; constexpr revrange(int64_t l_, int64_t r_) : l(l_ - 1), r(std::max(l_, r_) - 1) {} constexpr itr begin() const { return r; } constexpr itr end() const { return l; } }; using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; constexpr i32 inf32 = (i32(1) << 30) - 1; constexpr i64 inf64 = (i64(1) << 62) - 1; int main() { u64 N; std::cin >> N; u32 ans = 0; for (u32 x = 2; x * x <= N; ++x) { if (N % x == 0) { u32 cnt = 0; while (N % x == 0) { N /= x; ++cnt; } u32 cur = 1; while (true) { if (cnt < cur) { break; } cnt -= cur; ++ans; ++cur; } } } if (N > 1) { ++ans; } std::cout << ans << '\n'; return 0; }
#include <algorithm> #include <iostream> #include <numeric> #include <utility> #include <vector> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (lhs < rhs) { lhs = rhs; return true; } return false; } struct range { struct itr { int64_t i; constexpr itr(int64_t i_) : i(i_) {} constexpr void operator++() { ++i; } constexpr int64_t operator*() const { return i; } constexpr bool operator!=(itr x) const { return i != x.i; } }; const itr l, r; constexpr range(int64_t l_, int64_t r_) : l(l_), r(std::max(l_, r_)) {} constexpr itr begin() const { return l; } constexpr itr end() const { return r; } }; struct revrange { struct itr { int64_t i; constexpr itr(int64_t i_) : i(i_) {} constexpr void operator++() { --i; } constexpr int64_t operator*() const { return i; } constexpr bool operator!=(itr x) const { return i != x.i; } }; const itr l, r; constexpr revrange(int64_t l_, int64_t r_) : l(l_ - 1), r(std::max(l_, r_) - 1) {} constexpr itr begin() const { return r; } constexpr itr end() const { return l; } }; using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; constexpr i32 inf32 = (i32(1) << 30) - 1; constexpr i64 inf64 = (i64(1) << 62) - 1; int main() { u64 N; std::cin >> N; u32 ans = 0; for (u64 x = 2; x * x <= N; ++x) { if (N % x == 0) { u32 cnt = 0; while (N % x == 0) { N /= x; ++cnt; } u32 cur = 1; while (true) { if (cnt < cur) { break; } cnt -= cur; ++ans; ++cur; } } } if (N > 1) { ++ans; } std::cout << ans << '\n'; return 0; }
replace
64
65
64
65
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, ans = 0; cin >> n; unordered_map<long long int, int> mp; while (n % 2 == 0) { mp[2]++; n = n / 2; } for (long long int i = 3; i <= sqrt(n); i = i + 2) { while (n % i == 0) { mp[i]++; n = n / i; } } if (n > 2) { mp[n]++; } for (auto it = mp.begin(); it != mp.end(); it++) { long long int l = 1, r = it->second, temp = it->second; while (l <= r) { long long int mid = l + (r - l) / 2; if ((mid * (mid + 1)) / 2 <= temp && ((mid + 2) * (mid + 1)) / 2 <= temp) { mid = l + 1; } else if ((mid * (mid + 1)) / 2 <= temp && ((mid + 2) * (mid + 1)) / 2 > temp) { ans = ans + mid; break; } else if (((mid) * (mid + 1)) / 2 > temp) { r = mid - 1; } } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, ans = 0; cin >> n; unordered_map<long long int, int> mp; while (n % 2 == 0) { mp[2]++; n = n / 2; } for (long long int i = 3; i <= sqrt(n); i = i + 2) { while (n % i == 0) { mp[i]++; n = n / i; } } if (n > 2) { mp[n]++; } for (auto it = mp.begin(); it != mp.end(); it++) { long long int l = 1, r = it->second, temp = it->second; while (l <= r) { long long int mid = l + (r - l) / 2; if ((mid * (mid + 1)) / 2 <= temp && ((mid + 2) * (mid + 1)) / 2 <= temp) { l = mid + 1; } else if ((mid * (mid + 1)) / 2 <= temp && ((mid + 2) * (mid + 1)) / 2 > temp) { ans = ans + mid; break; } else if (((mid) * (mid + 1)) / 2 > temp) { r = mid - 1; } } } cout << ans; return 0; }
replace
35
36
35
36
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; /*bool compare_function(const pair<int, int> a, const pair<int, int> b) { return a.first < b.first; }*/ // use case // sort(V.begin(), V.end(), compare_function); /*struct compare { bool operator ()(const pair<int, int> &a, const pair<int, int> &b) { if (a.second-a.first==b.second-b.first) { return a.first>b.first; } return a.second-a.first < b.second-b.first;} }; priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/ /*void print1(vector <int> X) { for (int i=0; i<X.size(); i++) { cout<<X[i]<<" "; } cout<<endl; return; } void print2(vector <vector <int>> X) { for (int i=0; i<X.size(); i++) { for (int j=0;j<X[i].size();j++) { cout<<X[i][j]<<" ";} cout<<endl;} return; }*/ int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; int p = 2; int ats = 0; while (p * p <= n) { if (n % p == 0) { int laip = 0; while (n % p == 0) { n = n / p; laip++; } int i = 1; while (laip >= i) { ats++; laip = laip - i; i++; } } p++; } if (n > 1) { ats++; } cout << ats << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; /*bool compare_function(const pair<int, int> a, const pair<int, int> b) { return a.first < b.first; }*/ // use case // sort(V.begin(), V.end(), compare_function); /*struct compare { bool operator ()(const pair<int, int> &a, const pair<int, int> &b) { if (a.second-a.first==b.second-b.first) { return a.first>b.first; } return a.second-a.first < b.second-b.first;} }; priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/ /*void print1(vector <int> X) { for (int i=0; i<X.size(); i++) { cout<<X[i]<<" "; } cout<<endl; return; } void print2(vector <vector <int>> X) { for (int i=0; i<X.size(); i++) { for (int j=0;j<X[i].size();j++) { cout<<X[i][j]<<" ";} cout<<endl;} return; }*/ int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; ll p = 2; int ats = 0; while (p * p <= n) { if (n % p == 0) { int laip = 0; while (n % p == 0) { n = n / p; laip++; } int i = 1; while (laip >= i) { ats++; laip = laip - i; i++; } } p++; } if (n > 1) { ats++; } cout << ats << endl; return 0; }
replace
56
57
56
57
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <vector> // #include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ... #define pi 3.14159265358979323846 #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using ld = long double; using Byte = unsigned char; using namespace std; bool isZero = true; // string ans = "Yes"; ll ans = 0; ll N; vector<ll> A; int main() { cin >> N; vector<ll> prime; vector<ll> primeF; ll nowP = 1; ll tmpN = N; if (tmpN % 2 == 0) { ll F = 0; while (tmpN % 2 == 0) { F++; tmpN /= 2; } prime.push_back(2); primeF.push_back(F); } while (tmpN > 1) { nowP += 2; if (nowP > sqrt(N) && primeF.size() == 0) { prime.push_back(N); primeF.push_back(1); break; } if (tmpN % nowP != 0) continue; int F = 0; while (tmpN % nowP == 0) { F++; tmpN /= nowP; } prime.push_back(nowP); primeF.push_back(F); } // 線形探索... for (int p : primeF) { ll x = 0; while ((x + 1) * (x + 2) / 2 <= p) { x++; } ans += x; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <vector> // #include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ... #define pi 3.14159265358979323846 #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using ld = long double; using Byte = unsigned char; using namespace std; bool isZero = true; // string ans = "Yes"; ll ans = 0; ll N; vector<ll> A; int main() { cin >> N; vector<ll> prime; vector<ll> primeF; ll nowP = 1; ll tmpN = N; if (tmpN % 2 == 0) { ll F = 0; while (tmpN % 2 == 0) { F++; tmpN /= 2; } prime.push_back(2); primeF.push_back(F); } while (tmpN > 1) { nowP += 2; if (nowP > sqrt(N)) { prime.push_back(tmpN); primeF.push_back(1); break; } if (tmpN % nowP != 0) continue; int F = 0; while (tmpN % nowP == 0) { F++; tmpN /= nowP; } prime.push_back(nowP); primeF.push_back(F); } // 線形探索... for (int p : primeF) { ll x = 0; while ((x + 1) * (x + 2) / 2 <= p) { x++; } ans += x; } cout << ans << endl; return 0; }
replace
42
44
42
44
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI) #define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n); i++) int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; typedef long long ll; map<ll, ll> prime_factor(ll n) { map<ll, ll> res; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } int main() { ll N; ll ans = 0; cin >> N; map<ll, ll> prime = prime_factor(N); for (auto p : prime) { ll max_e = p.second; int e = 1; int cnt = 0; while (max_e >= e) { cnt++; max_e -= e; e++; } ans += cnt; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI) #define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n); i++) int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; typedef long long ll; map<ll, ll> prime_factor(ll n) { map<ll, ll> res; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } int main() { ll N; ll ans = 0; cin >> N; map<ll, ll> prime = prime_factor(N); for (auto p : prime) { ll max_e = p.second; int e = 1; int cnt = 0; while (max_e >= e) { cnt++; max_e -= e; e++; } ans += cnt; } cout << ans << endl; return 0; }
replace
19
20
19
20
TLE
p02660
C++
Time Limit Exceeded
/* Reference:- */ #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define forn(i, n) for (int i = 0; i < int(n); i++) #define forn1(i, n) for (int i = 1; i < int(n); i++) #define PI pair<int, int> #define all(vec) vec.begin(), vec.end() ll mod = 1000000007; const int N = 2e5 + 5; ll power(ll n, ll k) { ll ans = 1; while (k) { if (k & 1) ans = (ans * n) % mod; k /= 2; n = (n * n) % mod; } // ans=(ans-1+mod)%mod; return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a; cin >> a; ll ans = 0; ll n = a; for (int i = 2; i * i <= a; i++) { if (n % i == 0) { ll co = 0; while (n % i == 0) { n /= i; co++; } // cout<<i<<" "<<co<<" "; ll sum = 1, num = 1; while (sum <= co) { sum = (num * (num + 1)) / 2; num++; } // cout<<num<<endl; ans += num - 2; } } if (n > 1) ans++; cout << ans; return 0; }
/* Reference:- */ #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define forn(i, n) for (int i = 0; i < int(n); i++) #define forn1(i, n) for (int i = 1; i < int(n); i++) #define PI pair<int, int> #define all(vec) vec.begin(), vec.end() ll mod = 1000000007; const int N = 2e5 + 5; ll power(ll n, ll k) { ll ans = 1; while (k) { if (k & 1) ans = (ans * n) % mod; k /= 2; n = (n * n) % mod; } // ans=(ans-1+mod)%mod; return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a; cin >> a; ll ans = 0; ll n = a; for (ll i = 2; i * i <= a; i++) { if (n % i == 0) { ll co = 0; while (n % i == 0) { n /= i; co++; } // cout<<i<<" "<<co<<" "; ll sum = 1, num = 1; while (sum <= co) { sum = (num * (num + 1)) / 2; num++; } // cout<<num<<endl; ans += num - 2; } } if (n > 1) ans++; cout << ans; return 0; }
replace
34
35
34
35
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" const int mod = 1e9 + 7; inline int add(int a, int b) { int res = a + b; if (res >= mod) res -= mod; return res; } inline int sub(int a, int b) { int res = a - b; if (res < 0) res += mod; return res; } inline int mul(int a, int b) { return (a * b) % mod; } void solve() { int n; cin >> n; if (n == 1) { cout << 0 << endl; return; } vector<int> v; bool is = true; for (int i = 2; i * i <= n; i++) if (n % i == 0) { is = false; break; } if (is) { cout << 1 << endl; return; } int x = n; int lim = 1e6; for (int i = 2; i <= max(lim, x); i++) { if (x % i == 0) { int cnt = 0; while (x % i == 0) { cnt++; x /= i; } v.push_back(cnt); } } if (x != 1) v.push_back(1); int ans = 0; for (int a : v) { int i = 1; while (i * (i + 1) / 2 <= a) { i++; } i--; ans += i; } cout << ans << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(12); int T = 1; // cin >> T; while (T--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" const int mod = 1e9 + 7; inline int add(int a, int b) { int res = a + b; if (res >= mod) res -= mod; return res; } inline int sub(int a, int b) { int res = a - b; if (res < 0) res += mod; return res; } inline int mul(int a, int b) { return (a * b) % mod; } void solve() { int n; cin >> n; if (n == 1) { cout << 0 << endl; return; } vector<int> v; bool is = true; for (int i = 2; i * i <= n; i++) if (n % i == 0) { is = false; break; } if (is) { cout << 1 << endl; return; } int x = n; int lim = 1e6; for (int i = 2; i <= min(lim, x); i++) { if (x % i == 0) { int cnt = 0; while (x % i == 0) { cnt++; x /= i; } v.push_back(cnt); } } if (x != 1) v.push_back(1); int ans = 0; for (int a : v) { int i = 1; while (i * (i + 1) / 2 <= a) { i++; } i--; ans += i; } cout << ans << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(12); int T = 1; // cin >> T; while (T--) { solve(); } return 0; }
replace
41
42
41
42
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 2e5 + 5; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, ans = 0; cin >> n; vector<int> v; for (int i = 1; i <= 100; i++) { v.push_back(i * (i + 1) / 2); } for (int i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } if (cnt) ans += upper_bound(v.begin(), v.end(), cnt) - v.begin(); } if (n != 1) ans++; cout << ans; return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 2e5 + 5; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, ans = 0; cin >> n; vector<int> v; for (int i = 1; i <= 100; i++) { v.push_back(i * (i + 1) / 2); } for (ll i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } if (cnt) ans += upper_bound(v.begin(), v.end(), cnt) - v.begin(); } if (n != 1) ans++; cout << ans; return 0; }
replace
15
16
15
16
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define F first #define S second #define sz(x) (int)x.size() #define all(x) (x).begin(), (x).end() #define Blue \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, n) for (int i = a; i < n; ++i) typedef vector<int> vi; typedef long long ll; const int mod = 1e9 + 7; const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; vector<ll> q; ll getAns(ll m) { ll x = 0; auto it = upper_bound(all(q), m) - q.begin() - 1; return it; } void solve() { ll n; cin >> n; ll ans = 0; for (ll i = 0; i <= 8; i++) { q.pb(((i + 1) * i) / 2); } for (ll i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { cnt++; n /= i; } ll j = 0; for (; j <= 8;) { if ((j * (j + 1)) <= cnt) j++; } j--; ans += j; } if (n > 1) ans++; cout << ans; } int main() { Blue; int test = 1; // cin>>test; while (test--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define F first #define S second #define sz(x) (int)x.size() #define all(x) (x).begin(), (x).end() #define Blue \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, n) for (int i = a; i < n; ++i) typedef vector<int> vi; typedef long long ll; const int mod = 1e9 + 7; const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; vector<ll> q; ll getAns(ll m) { ll x = 0; auto it = upper_bound(all(q), m) - q.begin() - 1; return it; } void solve() { ll n; cin >> n; ll ans = 0; for (ll i = 0; i <= 8; i++) { q.pb(((i + 1) * i) / 2); } for (ll i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { cnt++; n /= i; } ans += getAns(cnt); } if (n > 1) ans++; cout << ans; } int main() { Blue; int test = 1; // cin>>test; while (test--) solve(); return 0; }
replace
41
48
41
42
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } typedef pair<int, int> P; const int MOD = 1e9 + 7; // const int MOD = 998244353; const int INF = 1e18; const long double PI = (acos(-1)); bool isPrime(int x) { int i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } signed main() { int N; cin >> N; if (N == 1) { cout << 0; return 0; } if (isPrime(N)) { cout << 1; return 0; } int ans = 0; for (int i = 2; i <= N; i++) { if (N % i == 0) { int cnt = 0; while (N % i == 0) { cnt++; N /= i; } int a = sqrt(1 + 8 * cnt); int b = (-1 + a) / 2; ans += b; } } cout << ans; }
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } typedef pair<int, int> P; const int MOD = 1e9 + 7; // const int MOD = 998244353; const int INF = 1e18; const long double PI = (acos(-1)); bool isPrime(int x) { int i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } signed main() { int N; cin >> N; if (N == 1) { cout << 0; return 0; } if (isPrime(N)) { cout << 1; return 0; } int ans = 0; for (int i = 2; i <= N; i++) { if (N % i == 0) { int cnt = 0; while (N % i == 0) { cnt++; N /= i; } int a = sqrt(1 + 8 * cnt); int b = (-1 + a) / 2; ans += b; } else { if (i * i > N) { ans++; break; } } } cout << ans; }
insert
75
75
75
80
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define F first #define S second #define sz(x) (int)x.size() #define all(x) (x).begin(), (x).end() #define Blue \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, n) for (int i = a; i < n; ++i) typedef vector<int> vi; typedef long long ll; const int mod = 1e9 + 7; const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; vector<ll> q; ll getAns(ll m) { ll x = 0; auto it = upper_bound(all(q), m) - q.begin() - 1; return it; } void solve() { ll n; cin >> n; ll ans = 0; for (ll i = 0; i <= 1e6; i++) { q.pb(((i + 1) * i) / 2); } for (int i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { cnt++; n /= i; } ans += getAns(cnt); } if (n > 1) ans++; cout << ans; } int main() { Blue; int test = 1; // cin>>test; while (test--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define F first #define S second #define sz(x) (int)x.size() #define all(x) (x).begin(), (x).end() #define Blue \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, n) for (int i = a; i < n; ++i) typedef vector<int> vi; typedef long long ll; const int mod = 1e9 + 7; const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; vector<ll> q; ll getAns(ll m) { ll x = 0; auto it = upper_bound(all(q), m) - q.begin() - 1; return it; } void solve() { ll n; cin >> n; ll ans = 0; for (ll i = 0; i <= 1e6; i++) { q.pb(((i + 1) * i) / 2); } for (ll i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { cnt++; n /= i; } ans += getAns(cnt); } if (n > 1) ans++; cout << ans; } int main() { Blue; int test = 1; // cin>>test; while (test--) solve(); return 0; }
replace
35
36
35
36
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using v = vector<int>; using vv = vector<v>; const int MOD = 1000000007; const ll INF = 1001001001001; int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } v a; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { a.push_back(0); while (n % i == 0) { a[a.size() - 1]++; n /= i; } } } if (n != 1) { a.push_back(1); } int ans = 0; for (int i = 0; i < a.size(); i++) { double t = (sqrt(8 * a[i] + 1) - 1) / 2.0; ans += (int)t; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using v = vector<int>; using vv = vector<v>; const int MOD = 1000000007; const ll INF = 1001001001001; int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } v a; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { a.push_back(0); while (n % i == 0) { a[a.size() - 1]++; n /= i; } } } if (n != 1) { a.push_back(1); } int ans = 0; for (int i = 0; i < a.size(); i++) { double t = (sqrt(8 * a[i] + 1) - 1) / 2.0; ans += (int)t; } cout << ans << endl; return 0; }
replace
22
23
22
23
TLE
p02660
C++
Time Limit Exceeded
/* Author: Babin Dutta */ #include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long int #define pb push_back #define mp make_pair #define boost \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, n) for (int i = 0; i < n; i++) #define ff(i, a, b) for (int i = a; i <= b; i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() // #define endl "\n" #define inf 1e18 #define mm 998244353 ll power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; } ll modInverse(ll A, ll M) { return power(A, M - 2, M); } /* bool pp[1000001]; void func(){ for(int i=2;i*i<=1000000;i++){ if(pp[i]){ for(int j=i*i;j<=1000000;j+=i) pp[j] = false; } } } */ vector<ll> v; void solve() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return; } ll z = n; set<ll> s; ll m = 0; while (n % 2 == 0) { n /= 2; m++; } for (ll k = 1; k <= m; k++) { v.pb(pow(2, k)); } for (ll i = 3; i * i <= n; i += 2) { m = 0; while (n % i == 0) { n /= i; m++; } for (ll k = 1; k <= m; k++) { v.pb(pow(i, k)); } } if (n > 2) v.pb(n); sort(all(v)); ll y = 1; while (z > 1) { for (ll i = 0; i < v.size(); i++) { if (v[i] < y) continue; if (z % v[i] == 0 && z > 1) { z /= v[i]; s.insert(v[i]); y = v[i]; } } } cout << s.size() << endl; } int main() { #ifdef JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif boost; int t = 1; // cin>>t; for (int i = 1; i <= t; i++) solve(); return 0; }
/* Author: Babin Dutta */ #include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long int #define pb push_back #define mp make_pair #define boost \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, n) for (int i = 0; i < n; i++) #define ff(i, a, b) for (int i = a; i <= b; i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() // #define endl "\n" #define inf 1e18 #define mm 998244353 ll power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; } ll modInverse(ll A, ll M) { return power(A, M - 2, M); } /* bool pp[1000001]; void func(){ for(int i=2;i*i<=1000000;i++){ if(pp[i]){ for(int j=i*i;j<=1000000;j+=i) pp[j] = false; } } } */ vector<ll> v; void solve() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return; } ll z = n; set<ll> s; ll m = 0; while (n % 2 == 0) { n /= 2; m++; } for (ll k = 1; k <= m; k++) { v.pb(pow(2, k)); } for (ll i = 3; i * i <= n; i += 2) { m = 0; while (n % i == 0) { n /= i; m++; } for (ll k = 1; k <= m; k++) { v.pb(pow(i, k)); } } if (n > 2) v.pb(n); sort(all(v)); ll y = 1; for (int i = 0; i < v.size(); i++) { if (v[i] <= y) continue; if (z % v[i] == 0) { z /= v[i]; s.insert(v[i]); y = v[i]; } } cout << s.size() << endl; } int main() { #ifdef JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif boost; int t = 1; // cin>>t; for (int i = 1; i <= t; i++) solve(); return 0; }
replace
80
89
80
87
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll LINF = 1e18; const int INF = 1e9; const ll MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } vector<pair<ll, ll>> fact(ll n) { vector<pair<ll, ll>> p; for (int i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { n /= i; cnt++; } p.push_back(make_pair(i, cnt)); } if (n != 1) p.push_back(make_pair(n, 1)); return p; } int main() { ll n; cin >> n; const auto &res = fact(n); int ans = 0; for (auto iter : res) { int cnt = iter.second; int i = 1; while (cnt >= i) { cnt -= i; i++; ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll LINF = 1e18; const int INF = 1e9; const ll MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } vector<pair<ll, ll>> fact(ll n) { vector<pair<ll, ll>> p; for (ll i = 2; i * i <= n; i++) { ll cnt = 0; while (n % i == 0) { n /= i; cnt++; } p.push_back(make_pair(i, cnt)); } if (n != 1) p.push_back(make_pair(n, 1)); return p; } int main() { ll n; cin >> n; const auto &res = fact(n); int ans = 0; for (auto iter : res) { int cnt = iter.second; int i = 1; while (cnt >= i) { cnt -= i; i++; ans++; } } cout << ans << endl; return 0; }
replace
26
27
26
27
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define ll long long #define mk make_pair template <class key, class cmp = std::less<key>> using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; const ll mod = 1e9 + 7; /* if you have any question about any part of my code, please don't shy to ask anytime :) */ bool isprime(ll n) { if (n == 2) return true; if (n % 2 == 0 || n < 2) return false; for (int i = 3; i * i <= n; i++) { if (n % i == 0) return false; } return true; } void solve() { ll n; cin >> n; ll ans = 0; unordered_set<ll> s; unordered_map<ll, ll> h; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { s.insert(i); n /= i; h[i]++; } } if (n > 1) { s.insert(n); h[n]++; } for (auto it : s) { for (int i = 1;; i++) { if (h[it] >= i) { ans++; h[it] -= i; } else { break; } } } cout << ans << endl; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // ll t; // cin >> t; // while (t--) // { // solve(); // } solve(); return 0; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define ll long long #define mk make_pair template <class key, class cmp = std::less<key>> using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; const ll mod = 1e9 + 7; /* if you have any question about any part of my code, please don't shy to ask anytime :) */ bool isprime(ll n) { if (n == 2) return true; if (n % 2 == 0 || n < 2) return false; for (int i = 3; i * i <= n; i++) { if (n % i == 0) return false; } return true; } void solve() { ll n; cin >> n; ll ans = 0; unordered_set<ll> s; unordered_map<ll, ll> h; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { s.insert(i); n /= i; h[i]++; } } if (n > 1) { s.insert(n); h[n]++; } for (auto it : s) { for (int i = 1;; i++) { if (h[it] >= i) { ans++; h[it] -= i; } else { break; } } } cout << ans << endl; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // ll t; // cin >> t; // while (t--) // { // solve(); // } solve(); return 0; }
replace
42
43
42
43
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define sz(x) (int)((x).size()) #define all(x) (x).begin(), (x).end() #define FO(x) \ { \ freopen(#x ".in", "r", stdin); \ freopen(#x ".out", "w", stdout); \ } #define eb emplace_back typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<pii> vpii; typedef vector<vpii> vvpii; typedef vector<pll> vpll; typedef long double ld; typedef vector<ld> vld; typedef unsigned int uint; template <uint MD> struct ModInt { using M = ModInt; const static M G; uint v; ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); } M &set_v(uint _v) { v = (_v < MD) ? _v : _v - MD; return *this; } explicit operator bool() const { return v != 0; } M operator-() const { return M() - *this; } M operator+(const M &r) const { return M().set_v(v + r.v); } M operator-(const M &r) const { return M().set_v(v + MD - r.v); } M operator*(const M &r) const { return M().set_v(uint(ull(v) * r.v % MD)); } M operator/(const M &r) const { return *this * r.inv(); } M &operator+=(const M &r) { return *this = *this + r; } M &operator-=(const M &r) { return *this = *this - r; } M &operator*=(const M &r) { return *this = *this * r; } M &operator/=(const M &r) { return *this = *this / r; } bool operator==(const M &r) const { return v == r.v; } const bool operator<(const M &o) const { return v < o.v; } M pow(ll n) const { M x = *this, r = 1; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } M inv() const { return pow(MD - 2); } friend ostream &operator<<(ostream &os, const M &r) { return os << r.v; } }; using Mint = ModInt<(int)1e9 + 7>; int main() { #ifdef BLAT freopen("stdin", "r", stdin); freopen("stderr", "w", stderr); #endif ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(12); srand(time(NULL)); ll n; cin >> n; int ans = 0; for (int i = 2; i * i <= n; ++i) { int e = 0; while (n % i == 0) { n /= i; ++e; } for (int j = 1; j <= e; ++j) { e -= j; ++ans; } } if (n != 1) ++ans; cout << ans << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define sz(x) (int)((x).size()) #define all(x) (x).begin(), (x).end() #define FO(x) \ { \ freopen(#x ".in", "r", stdin); \ freopen(#x ".out", "w", stdout); \ } #define eb emplace_back typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<pii> vpii; typedef vector<vpii> vvpii; typedef vector<pll> vpll; typedef long double ld; typedef vector<ld> vld; typedef unsigned int uint; template <uint MD> struct ModInt { using M = ModInt; const static M G; uint v; ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); } M &set_v(uint _v) { v = (_v < MD) ? _v : _v - MD; return *this; } explicit operator bool() const { return v != 0; } M operator-() const { return M() - *this; } M operator+(const M &r) const { return M().set_v(v + r.v); } M operator-(const M &r) const { return M().set_v(v + MD - r.v); } M operator*(const M &r) const { return M().set_v(uint(ull(v) * r.v % MD)); } M operator/(const M &r) const { return *this * r.inv(); } M &operator+=(const M &r) { return *this = *this + r; } M &operator-=(const M &r) { return *this = *this - r; } M &operator*=(const M &r) { return *this = *this * r; } M &operator/=(const M &r) { return *this = *this / r; } bool operator==(const M &r) const { return v == r.v; } const bool operator<(const M &o) const { return v < o.v; } M pow(ll n) const { M x = *this, r = 1; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } M inv() const { return pow(MD - 2); } friend ostream &operator<<(ostream &os, const M &r) { return os << r.v; } }; using Mint = ModInt<(int)1e9 + 7>; int main() { #ifdef BLAT freopen("stdin", "r", stdin); freopen("stderr", "w", stderr); #endif ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(12); srand(time(NULL)); ll n; cin >> n; int ans = 0; for (int i = 2; 1ll * i * i <= n; ++i) { int e = 0; while (n % i == 0) { n /= i; ++e; } for (int j = 1; j <= e; ++j) { e -= j; ++ans; } } if (n != 1) ++ans; cout << ans << '\n'; return 0; }
replace
82
83
82
83
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <unordered_map> #include <vector> #define ll long long using namespace std; const int lim = 5e6; int lp[lim + 10], pr[lim], cnt = 0; vector<ll> V; unordered_map<ll, int> mp; ll n; void sieve() { for (int i = 2; i <= lim; i++) { if (lp[i] == 0) lp[i] = pr[++cnt] = i; int j = 1; while (j <= cnt && pr[j] <= lp[i] && i * pr[j] <= lim) { lp[i * pr[j]] = pr[j]; j++; } } } bool prime(long long x) { if (x < 2) return false; for (long long i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } void add() { for (ll i = 2; i <= lim; i++) if (lp[i] == i) for (ll temp = i; temp <= (ll)1e13; temp *= i) V.push_back(temp); } int main() { /*sieve(); add(); sort(V.begin(),V.end()); cin >> n; ll ans = 0 , tmp = 1; for (auto x : V) if (n % x == 0 && x <= n) n /= x , ans++ , tmp = x; if (prime(n) == true && n > tmp) ans++; cout << ans;*/ ll ans = 0; cin >> n; for (int i = 2; i * i <= n; i++) if (n % i == 0) { while (n % i == 0) { n /= i; mp[i]++; } V.push_back(i); } if (n > 1) V.push_back(n), mp[n]++; for (auto x : V) { int sum = 1; while (mp[x] >= sum) mp[x] -= sum, ans++, sum++; } cout << ans; return 0; }
#include <algorithm> #include <iostream> #include <unordered_map> #include <vector> #define ll long long using namespace std; const int lim = 5e6; int lp[lim + 10], pr[lim], cnt = 0; vector<ll> V; unordered_map<ll, int> mp; ll n; void sieve() { for (int i = 2; i <= lim; i++) { if (lp[i] == 0) lp[i] = pr[++cnt] = i; int j = 1; while (j <= cnt && pr[j] <= lp[i] && i * pr[j] <= lim) { lp[i * pr[j]] = pr[j]; j++; } } } bool prime(long long x) { if (x < 2) return false; for (long long i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } void add() { for (ll i = 2; i <= lim; i++) if (lp[i] == i) for (ll temp = i; temp <= (ll)1e13; temp *= i) V.push_back(temp); } int main() { /*sieve(); add(); sort(V.begin(),V.end()); cin >> n; ll ans = 0 , tmp = 1; for (auto x : V) if (n % x == 0 && x <= n) n /= x , ans++ , tmp = x; if (prime(n) == true && n > tmp) ans++; cout << ans;*/ ll ans = 0; cin >> n; for (ll i = 2; i * i <= n; i++) if (n % i == 0) { while (n % i == 0) { n /= i; mp[i]++; } V.push_back(i); } if (n > 1) V.push_back(n), mp[n]++; for (auto x : V) { int sum = 1; while (mp[x] >= sum) mp[x] -= sum, ans++, sum++; } cout << ans; return 0; }
replace
49
50
49
50
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; long long n; vector<pair<int, int>> ve; void factorize(long long n) { for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int temp = 0; while (n % i == 0) { n /= i; temp++; } ve.emplace_back(i, temp); } } if (n > 1) { ve.emplace_back(n, 1); } } int f(int a) { int r = a, l = 0, ans = -1; while (r >= l) { int mid = (r + l) / 2; if (mid * (mid + 1) / 2 > a) { r = mid - 1; } else { ans = mid; l = mid + 1; } } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n; factorize(n); int ans = 0; for (auto i : ve) { ans += f(i.second); } cout << ans << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; long long n; vector<pair<int, int>> ve; void factorize(long long n) { for (long long i = 2; i * i <= n; i++) { if (n % i == 0) { int temp = 0; while (n % i == 0) { n /= i; temp++; } ve.emplace_back(i, temp); } } if (n > 1) { ve.emplace_back(n, 1); } } int f(int a) { int r = a, l = 0, ans = -1; while (r >= l) { int mid = (r + l) / 2; if (mid * (mid + 1) / 2 > a) { r = mid - 1; } else { ans = mid; l = mid + 1; } } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n; factorize(n); int ans = 0; for (auto i : ve) { ans += f(i.second); } cout << ans << '\n'; return 0; }
replace
7
8
7
8
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define MOD 1000000007 int main() { ll n; cin >> n; map<ll, ll> mp; for (int i = 2; i * i <= n; ++i) { while (n % i == 0) { mp[i]++; n /= i; } } if (n != 1) { mp[n]++; } ll ans = 0; vector<ll> s(51); for (int i = 0; i < 50; ++i) { s[i + 1] = s[i] + (i + 1); } for (auto a : mp) { ll key = a.first; ll value = a.second; ll res = upper_bound(s.begin(), s.end(), value) - s.begin() - 1; ans += res; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define MOD 1000000007 int main() { ll n; cin >> n; map<ll, ll> mp; for (ll i = 2; i * i <= n; ++i) { while (n % i == 0) { mp[i]++; n /= i; } } if (n != 1) { mp[n]++; } ll ans = 0; vector<ll> s(51); for (int i = 0; i < 50; ++i) { s[i + 1] = s[i] + (i + 1); } for (auto a : mp) { ll key = a.first; ll value = a.second; ll res = upper_bound(s.begin(), s.end(), value) - s.begin() - 1; ans += res; } cout << ans << endl; return 0; }
replace
23
24
23
24
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define ret return #define PB push_back #define lc 2 * v #define rc 2 * v + 1 #define mid (s + e) / 2 #define pii pair<int, int> #define pll pair<long long, long long> #define FAST \ ios::sync_with_stdio(false); \ cin.tie(0); #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") const int maxn = 2e6; bool notprime[maxn + 100]; ll cnt[maxn + 100]; ll n; vector<int> divi; inline void getdiv() { notprime[1] = 1; ll k = n; for (int i = 2; i < maxn; ++i) { if (!notprime[i]) { for (int j = i + i; j < maxn; j += i) { notprime[j] = 1; } if (k % i == 0) { divi.PB(i); } while (k % i == 0) { cnt[i]++; k /= i; } } } if (k > 1) { divi.PB(k); } } int main() { FAST cin >> n; getdiv(); ll ans = 0; for (auto u : divi) { if (u >= maxn) { ans++; } else { ll val = cnt[u]; ll cnt = 1; while (val >= cnt) { val -= cnt; cnt++; ans++; } } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define ret return #define PB push_back #define lc 2 * v #define rc 2 * v + 1 #define mid (s + e) / 2 #define pii pair<int, int> #define pll pair<long long, long long> #define FAST \ ios::sync_with_stdio(false); \ cin.tie(0); #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") const int maxn = 2e6; bool notprime[maxn + 100]; ll cnt[maxn + 100]; ll n; vector<ll> divi; inline void getdiv() { notprime[1] = 1; ll k = n; for (int i = 2; i < maxn; ++i) { if (!notprime[i]) { for (int j = i + i; j < maxn; j += i) { notprime[j] = 1; } if (k % i == 0) { divi.PB(i); } while (k % i == 0) { cnt[i]++; k /= i; } } } if (k > 1) { divi.PB(k); } } int main() { FAST cin >> n; getdiv(); ll ans = 0; for (auto u : divi) { if (u >= maxn) { ans++; } else { ll val = cnt[u]; ll cnt = 1; while (val >= cnt) { val -= cnt; cnt++; ans++; } } } cout << ans << endl; }
replace
23
24
23
24
0
p02660
C++
Time Limit Exceeded
#pragma GCC optimize("Ofast") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORD(i, a, b) for (int i = (a); i > (b); i--) #define PPC(x) __builtin_popcount(x) #define MSB(x) (31 - __builtin_clz(x)) #define SZ(x) ((int)(x).size()) #define pb push_back #define ALL(x) (x).begin(), (x).end() #define ithBit(m, i) ((m) >> (i)&1) #define ft first #define sd second #define kw(a) ((a) * (a)) #ifdef DEBUG #include "debug.h" #else #define dbg(...) 0 #endif using namespace std; const int maxN = 1 << 19; long long T[maxN]; const long long INF = 1000000000000000000ll; void solve() { long long n; scanf("%lld", &n); int res = 0; for (int i = 2; i * i <= n; i++) if (n % i == 0) { int c = 0; while (n % i == 0) n /= i, c++; int j = 0, s = 0; while (s + j + 1 <= c) j++, s += j; res += j; } if (n != 1ll) res++; printf("%d\n", res); } int main() { int t = 1; // scanf ("%d", &t); while (t--) solve(); return 0; }
#pragma GCC optimize("Ofast") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORD(i, a, b) for (int i = (a); i > (b); i--) #define PPC(x) __builtin_popcount(x) #define MSB(x) (31 - __builtin_clz(x)) #define SZ(x) ((int)(x).size()) #define pb push_back #define ALL(x) (x).begin(), (x).end() #define ithBit(m, i) ((m) >> (i)&1) #define ft first #define sd second #define kw(a) ((a) * (a)) #ifdef DEBUG #include "debug.h" #else #define dbg(...) 0 #endif using namespace std; const int maxN = 1 << 19; long long T[maxN]; const long long INF = 1000000000000000000ll; void solve() { long long n; scanf("%lld", &n); int res = 0; for (long long i = 2; i * i <= n; i++) if (n % i == 0) { int c = 0; while (n % i == 0) n /= i, c++; int j = 0, s = 0; while (s + j + 1 <= c) j++, s += j; res += j; } if (n != 1ll) res++; printf("%d\n", res); } int main() { int t = 1; // scanf ("%d", &t); while (t--) solve(); return 0; }
replace
30
31
30
31
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; // print(fixed << setprecision(10)); #define rep(i, n) for (ll i = 0; i < (n); i++) #define repk(i, n, k) for (ll i = k; i < (n); i++) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl double PI = acos(-1.0); int INF = 1e9; ll LINF = 1e18; ll MOD = 1e9 + 7; int main() { cin.tie(0); ios_base::sync_with_stdio(false); ll n; cin >> n; int ans = 0, cnt, p; for (int i = 2; i * i < n; i++) { if (n % i == 0) { cnt = 0; p = i; while (n % p == 0) { n /= p; p *= i; cnt++; } ans += cnt; while (n % i == 0) { if (n % p == 0) n /= p; else p /= i; } } if (i != 2) i++; } if (n != 1) ans++; print(ans); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; // print(fixed << setprecision(10)); #define rep(i, n) for (ll i = 0; i < (n); i++) #define repk(i, n, k) for (ll i = k; i < (n); i++) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl double PI = acos(-1.0); int INF = 1e9; ll LINF = 1e18; ll MOD = 1e9 + 7; int main() { cin.tie(0); ios_base::sync_with_stdio(false); ll n; cin >> n; int ans = 0, cnt, p; for (ll i = 2; i * i < n; i++) { if (n % i == 0) { cnt = 0; p = i; while (n % p == 0) { n /= p; p *= i; cnt++; } ans += cnt; while (n % i == 0) { if (n % p == 0) n /= p; else p /= i; } } if (i != 2) i++; } if (n != 1) ans++; print(ans); return 0; }
replace
21
22
21
22
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; vector<pair<int64, int>> Factorize(int64 x) { vector<pair<int64, int>> r; for (int d = 2; d * d <= x; d++) { int c = 0; while (x % d == 0) { x /= d; c++; } if (c > 0) { r.push_back({d, c}); } } if (x > 1) r.push_back({x, 1}); return r; } int main() { ios::sync_with_stdio(false); cin.tie(0); int64 n; cin >> n; auto pfs = Factorize(n); int count = 0; for (auto [p, f] : pfs) { // cout << "p: " << p << " f: " << f << endl; for (int i = 1; i <= f; i++) { // cout << i << " " << f << endl; f -= i; count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; vector<pair<int64, int>> Factorize(int64 x) { vector<pair<int64, int>> r; for (int64 d = 2; d * d <= x; d++) { int c = 0; while (x % d == 0) { x /= d; c++; } if (c > 0) { r.push_back({d, c}); } } if (x > 1) r.push_back({x, 1}); return r; } int main() { ios::sync_with_stdio(false); cin.tie(0); int64 n; cin >> n; auto pfs = Factorize(n); int count = 0; for (auto [p, f] : pfs) { // cout << "p: " << p << " f: " << f << endl; for (int i = 1; i <= f; i++) { // cout << i << " " << f << endl; f -= i; count++; } } cout << count << endl; }
replace
9
10
9
10
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; #define sz(a) int((a).size()) #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define ini(a, i) memset(a, i, sizeof(a)) #define contains(i, c) ((c).find(i) != (c).end()) #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define repa(i, a, b) for (int i = (a); i < (b); i++) #define repd(i, n) for (int i = (n)-1; i >= 0; i--) #define TRACE(x...) x #define watch(x) TRACE(cerr << #x " = " << x << endl) #define watch_all(x) \ TRACE(cerr << #x " = "; for (auto __i : x) cerr << __i << " "; cerr << endl) //========================= void run_test() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return; } ll ans = 0; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int p = 0; while (n % i == 0) { n /= i; p++; } int k = 1; while (p >= k) { p -= k; ans++; k++; } } } if (n > 1) ans++; cout << ans << endl; } //========================= int main() { ios::sync_with_stdio(0); cin.tie(0); // int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; // run_test(); } int t; cin >> t; while(t--) run_test(); run_test(); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; #define sz(a) int((a).size()) #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define ini(a, i) memset(a, i, sizeof(a)) #define contains(i, c) ((c).find(i) != (c).end()) #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define repa(i, a, b) for (int i = (a); i < (b); i++) #define repd(i, n) for (int i = (n)-1; i >= 0; i--) #define TRACE(x...) x #define watch(x) TRACE(cerr << #x " = " << x << endl) #define watch_all(x) \ TRACE(cerr << #x " = "; for (auto __i : x) cerr << __i << " "; cerr << endl) //========================= void run_test() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return; } ll ans = 0; for (int i = 2; i <= 1000010; i++) { if (n % i == 0) { int p = 0; while (n % i == 0) { n /= i; p++; } int k = 1; while (p >= k) { p -= k; ans++; k++; } } } if (n > 1) ans++; cout << ans << endl; } //========================= int main() { ios::sync_with_stdio(0); cin.tie(0); // int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; // run_test(); } int t; cin >> t; while(t--) run_test(); run_test(); return 0; }
replace
43
44
43
44
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll #define vi vector<int> #define ii pair<int, int> #define vii vector<ii> #define INFLL 9e18 #define INF 2e9 #define EPS 1e-9 #define pb push_back #define emp emplace_back #define PI acos(-1.0) #define endl "\n" #define mp make_pair #define DEBUG 0 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // cout.tie(NULL); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long n; cin >> n; ll count = 0; ll ans = 0; bool isPrime = true; if (n == 1) isPrime = false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { isPrime = false; while (n % i == 0) { n /= i; count++; } double now = -0.5 + 0.5 * (sqrt(1.0 + 8.0 * (double)count)); // cout << i << " " << count << " " << now << endl; ans += (long long)now; count = 0; now = 0.0; } } if (n > 1) ans += 1; if (!isPrime) cout << ans << endl; else cout << 1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll #define vi vector<int> #define ii pair<int, int> #define vii vector<ii> #define INFLL 9e18 #define INF 2e9 #define EPS 1e-9 #define pb push_back #define emp emplace_back #define PI acos(-1.0) #define endl "\n" #define mp make_pair #define DEBUG 0 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // cout.tie(NULL); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long n; cin >> n; ll count = 0; ll ans = 0; bool isPrime = true; if (n == 1) isPrime = false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { isPrime = false; while (n % i == 0) { n /= i; count++; } double now = -0.5 + 0.5 * (sqrt(1.0 + 8.0 * (double)count)); // cout << i << " " << count << " " << now << endl; ans += (long long)now; count = 0; now = 0.0; } } if (n > 1) ans += 1; if (!isPrime) cout << ans << endl; else cout << 1 << endl; return 0; }
replace
38
39
38
39
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } ll choose2(ll n) { return n * (n - 1) / 2; } int main() { ll n; cin >> n; vector<int> res; int cnt = 0; if (n == 1) { cout << 0 << endl; return 0; } for (int a = 2; a * a <= n; a++) { if (n % a != 0) continue; int ex = 0; int tmp = 0; while (n % a == 0) { ex++; if (tmp < ex) { cnt++; tmp = ex; ex = 0; } n /= a; } } if (n != 1) cnt++; cout << cnt << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } ll choose2(ll n) { return n * (n - 1) / 2; } int main() { ll n; cin >> n; vector<int> res; int cnt = 0; if (n == 1) { cout << 0 << endl; return 0; } for (ll a = 2; a * a <= n; a++) { if (n % a != 0) continue; int ex = 0; int tmp = 0; while (n % a == 0) { ex++; if (tmp < ex) { cnt++; tmp = ex; ex = 0; } n /= a; } } if (n != 1) cnt++; cout << cnt << endl; return 0; }
replace
49
50
49
50
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define SpeeD ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define ll long long #define endl '\n' // pair<int, int> *p=new pair<int, int>[n]; // std::vector<pair<int,int>> vp; // v.push_back(make_pair(x,y)) // pair<int, int> p[1000001]; // string *s=new string [n]; // int freq[e]; // freq[a[i]-'a']++; freq[a[i]]++; using namespace std; ll n, t, m, c1, c2, c, x, y, sum, mn = 999999999, avg, pos, dif, j, dis, mx, xi, yi, q; vector<ll> v; set<int> s; map<string, ll> mp; bool PE(int x) { for (int i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } bool PR(string s) { int n = s.length(); for (int i = 0; i < n / 2; i++) if (s[i] != s[n - i - 1]) return false; return true; } int main(void) { SpeeD ll n; cin >> n; c = 0; while (n % 2 == 0) { n /= 2; c++; } // cout<<c; ll dif = (-1 + sqrt(1 + 8 * c)) / 2; for (int i = 3; i * i <= n; i++) { c1 = 0; while (n % i == 0) { c1++, n /= i; } dif += (-1 + sqrt(1 + 8 * c1)) / 2; } // cout<<n; if (n > 2) dif++; cout << dif; }
#include <bits/stdc++.h> #define SpeeD ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define ll long long #define endl '\n' // pair<int, int> *p=new pair<int, int>[n]; // std::vector<pair<int,int>> vp; // v.push_back(make_pair(x,y)) // pair<int, int> p[1000001]; // string *s=new string [n]; // int freq[e]; // freq[a[i]-'a']++; freq[a[i]]++; using namespace std; ll n, t, m, c1, c2, c, x, y, sum, mn = 999999999, avg, pos, dif, j, dis, mx, xi, yi, q; vector<ll> v; set<int> s; map<string, ll> mp; bool PE(int x) { for (int i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } bool PR(string s) { int n = s.length(); for (int i = 0; i < n / 2; i++) if (s[i] != s[n - i - 1]) return false; return true; } int main(void) { SpeeD ll n; cin >> n; c = 0; while (n % 2 == 0) { n /= 2; c++; } // cout<<c; ll dif = (-1 + sqrt(1 + 8 * c)) / 2; for (ll i = 3; i * i <= n; i++) { c1 = 0; while (n % i == 0) { c1++, n /= i; } dif += (-1 + sqrt(1 + 8 * c1)) / 2; } // cout<<n; if (n > 2) dif++; cout << dif; }
replace
43
44
43
44
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define p_ary(ary, a, b) \ do { \ cout << "["; \ for (int count = (a); count < (b); ++count) \ cout << ary[count] << ((b)-1 == count ? "" : ", "); \ cout << "]\n"; \ } while (0) #define p_map(map, it) \ do { \ cout << "{"; \ for (auto(it) = map.begin();; ++(it)) { \ if ((it) == map.end()) { \ cout << "}\n"; \ break; \ } else \ cout << "" << (it)->first << "=>" << (it)->second << ", "; \ } \ } while (0) template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { os << "(" << a.first << ", " << a.second << ")"; return os; } const char newl = '\n'; int main() { ll n; cin >> n; int ans = 0; for (int i = 2; i * i <= n; ++i) if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } for (int j = 1; j < 10; ++j) { if (cnt < j) break; ans++; cnt -= j; } } if (n > 1) ans++; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define p_ary(ary, a, b) \ do { \ cout << "["; \ for (int count = (a); count < (b); ++count) \ cout << ary[count] << ((b)-1 == count ? "" : ", "); \ cout << "]\n"; \ } while (0) #define p_map(map, it) \ do { \ cout << "{"; \ for (auto(it) = map.begin();; ++(it)) { \ if ((it) == map.end()) { \ cout << "}\n"; \ break; \ } else \ cout << "" << (it)->first << "=>" << (it)->second << ", "; \ } \ } while (0) template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { os << "(" << a.first << ", " << a.second << ")"; return os; } const char newl = '\n'; int main() { ll n; cin >> n; int ans = 0; for (ll i = 2; i * i <= n; ++i) if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } for (int j = 1; j < 10; ++j) { if (cnt < j) break; ans++; cnt -= j; } } if (n > 1) ans++; cout << ans << endl; }
replace
37
38
37
38
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ll long long #define pb push_back #define eb emplace_back #define mp make_pair #define pii pair<ll, ll> #define vi vector<ll> #define vii vector<pii> #define mi map<ll, ll> #define mii map<pii, ll> #define all(a) (a).begin(), (a).end() #define fi first #define si second #define sz(x) (ll) x.size() #define endl '\n' #define checkbit(n, b) ((n >> b) & 1) #define mod 1000000007 #define inf 1000000000000000000 #define puts(n) cout << n; #define rep(i, a, b) for (ll i = a; i < b; i++) #define setbits(x) __builtin_popcount(x) #define mset(m, v) memset(m, v, sizeof(m)) using namespace std; const ll M = 1000000 + 1; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector<bool> isp(M, true); for (ll i = 2; i * i < M; i++) { if (isp[i]) { for (ll j = i * i; j < M; j += i) isp[j] = false; } } vi primes; for (ll i = 2; i < M; i++) { if (isp[i]) primes.pb(i); } ll n; cin >> n; ll ans = 0; for (ll i = 0; primes[i] * primes[i] <= n; i++) { ll cnt = 0; while (n % primes[i] == 0) { cnt++; n /= primes[i]; } ll sum = 0, val = 0; while (sum + val <= cnt) { sum += val; val++; } ans += (val - 1); } if (n != 1) ans++; cout << ans; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ll long long #define pb push_back #define eb emplace_back #define mp make_pair #define pii pair<ll, ll> #define vi vector<ll> #define vii vector<pii> #define mi map<ll, ll> #define mii map<pii, ll> #define all(a) (a).begin(), (a).end() #define fi first #define si second #define sz(x) (ll) x.size() #define endl '\n' #define checkbit(n, b) ((n >> b) & 1) #define mod 1000000007 #define inf 1000000000000000000 #define puts(n) cout << n; #define rep(i, a, b) for (ll i = a; i < b; i++) #define setbits(x) __builtin_popcount(x) #define mset(m, v) memset(m, v, sizeof(m)) using namespace std; const ll M = 1000000 + 1; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector<bool> isp(M, true); for (ll i = 2; i * i < M; i++) { if (isp[i]) { for (ll j = i * i; j < M; j += i) isp[j] = false; } } vi primes; for (ll i = 2; i < M; i++) { if (isp[i]) primes.pb(i); } ll n; cin >> n; ll ans = 0; for (ll i = 0; i < primes.size() && primes[i] * primes[i] <= n; i++) { ll cnt = 0; while (n % primes[i] == 0) { cnt++; n /= primes[i]; } ll sum = 0, val = 0; while (sum + val <= cnt) { sum += val; val++; } ans += (val - 1); } if (n != 1) ans++; cout << ans; return 0; }
replace
45
46
45
46
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; int ans = 0; int div = 2; while (n > 1 && div * div <= n) { int cur = 0; int next = 1; while (n % div == 0) { cur++; if (cur == next) { cur = 0; next++; } n /= div; } div++; ans += next - 1; } if (n > 1) ans++; cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; int ans = 0; int div = 2; while (n > 1 && div * 1LL * div <= n) { int cur = 0; int next = 1; while (n % div == 0) { cur++; if (cur == next) { cur = 0; next++; } n /= div; } div++; ans += next - 1; } if (n > 1) ans++; cout << ans; return 0; }
replace
13
14
13
14
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = (1 << 30) - 1; const ll LINF = (1LL << 60) - 1; map<ll, int> prime_factor(ll n) { map<ll, int> ret; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } void solve() { ll n; cin >> n; auto mp = prime_factor(n); int ans = 0; for (auto p : mp) { int m = 1; while (p.se >= m) { ans++; p.se -= m; m++; } } cout << ans << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = (1 << 30) - 1; const ll LINF = (1LL << 60) - 1; map<ll, int> prime_factor(ll n) { map<ll, int> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } void solve() { ll n; cin >> n; auto mp = prime_factor(n); int ans = 0; for (auto p : mp) { int m = 1; while (p.se >= m) { ans++; p.se -= m; m++; } } cout << ans << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }
replace
30
31
30
31
TLE
p02660
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #include <map> using namespace std; map<long, int> fac(long n) { map<long, int> M; for (int i = 2; i <= n; i++) { if (n == 1) break; if (i * i > n) { M[n] = 1; break; } if (n % i == 0) { M[i] = 0; while (n % i == 0) { n /= i; M[i]++; } } } return M; } int main() { long N; cin >> N; map<long, int> M = fac(N); int c = 0; for (auto it = M.begin(); it != M.end(); it++) { c += (int)((-1.0 + sqrt(1.1 + 8.0 * it->second)) / 2.0); } cout << c << endl; }
#include <cmath> #include <iostream> #include <map> using namespace std; map<long, int> fac(long n) { map<long, int> M; for (long i = 2; i <= n; i++) { if (n == 1) break; if (i * i > n) { M[n] = 1; break; } if (n % i == 0) { M[i] = 0; while (n % i == 0) { n /= i; M[i]++; } } } return M; } int main() { long N; cin >> N; map<long, int> M = fac(N); int c = 0; for (auto it = M.begin(); it != M.end(); it++) { c += (int)((-1.0 + sqrt(1.1 + 8.0 * it->second)) / 2.0); } cout << c << endl; }
replace
7
8
7
8
TLE
p02660
C++
Runtime Error
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #define debug(x) cout << #x << " = " << (x) << endl; #define fs first #define sc second #define pb push_back #define eb emplace_back #define SP << " " << typedef long long ll; typedef pair<int, int> P; typedef tuple<int, int, int> T; typedef vector<int> vec; typedef vector<P> pvec; typedef vector<vector<int>> vvec; typedef vector<vector<P>> pvvec; typedef priority_queue<int> PQI; typedef priority_queue<P> PQP; typedef priority_queue<int, vector<int>, greater<int>> PQIG; typedef priority_queue<P, vector<P>, greater<P>> PQPG; const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1}; const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1}; constexpr int MOD = (1000000007); // const int MOD = (998244353); // const int INF = (1 << 30); // 1073741824 const ll INF = (1LL << 60); // 1152921504606846976 const double PI = (3.141592653589794); const double EPS = (0.0000000001); // 10^(-10) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline T ceil(T a, T b) { return T((a + b - 1) / b); } template <class T> inline T round(T a, T b) { return T(a / b); } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <class T> inline void out(T &a) { bool flag = true; for (auto &x : a) { if (flag) { flag = false; } else { cout << ' '; } cout << x; } cout << endl; } //---------------------------------------------------------------- int nmax = 200000; // 2*(10^5) vvec G(nmax); void solve4ts() { vector<bool> pri(1000000 + 100, true); for (int i = 2; i < 1000000 + 100; i++) { if (pri[i]) { for (int j = i * 2; j < 1000000 + 100; j += i) { pri[j] = false; } } } int n; cin >> n; int ans = 0; if (n == 1) { cout << 0 << endl; return; } for (int i = 2; i < 1000000 + 50; i++) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } int hiku = 1; while (cnt >= hiku) { cnt -= hiku; hiku++; ans++; } } if (ans == 0) exit(1); cout << ans << endl; } //----------------------------------------------------------------- signed main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); int repeat = 1; // cin >> repeat; while (repeat--) solve4ts(); }
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #define debug(x) cout << #x << " = " << (x) << endl; #define fs first #define sc second #define pb push_back #define eb emplace_back #define SP << " " << typedef long long ll; typedef pair<int, int> P; typedef tuple<int, int, int> T; typedef vector<int> vec; typedef vector<P> pvec; typedef vector<vector<int>> vvec; typedef vector<vector<P>> pvvec; typedef priority_queue<int> PQI; typedef priority_queue<P> PQP; typedef priority_queue<int, vector<int>, greater<int>> PQIG; typedef priority_queue<P, vector<P>, greater<P>> PQPG; const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1}; const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1}; constexpr int MOD = (1000000007); // const int MOD = (998244353); // const int INF = (1 << 30); // 1073741824 const ll INF = (1LL << 60); // 1152921504606846976 const double PI = (3.141592653589794); const double EPS = (0.0000000001); // 10^(-10) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline T ceil(T a, T b) { return T((a + b - 1) / b); } template <class T> inline T round(T a, T b) { return T(a / b); } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <class T> inline void out(T &a) { bool flag = true; for (auto &x : a) { if (flag) { flag = false; } else { cout << ' '; } cout << x; } cout << endl; } //---------------------------------------------------------------- int nmax = 200000; // 2*(10^5) vvec G(nmax); void solve4ts() { vector<bool> pri(1000000 + 100, true); for (int i = 2; i < 1000000 + 100; i++) { if (pri[i]) { for (int j = i * 2; j < 1000000 + 100; j += i) { pri[j] = false; } } } int n; cin >> n; int ans = 0; if (n == 1) { cout << 0 << endl; return; } for (int i = 2; i < 1000000 + 50; i++) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } int hiku = 1; while (cnt >= hiku) { cnt -= hiku; hiku++; ans++; } } if (n != 1) ans++; cout << ans << endl; } //----------------------------------------------------------------- signed main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); int repeat = 1; // cin >> repeat; while (repeat--) solve4ts(); }
replace
108
110
108
110
0
p02660
C++
Time Limit Exceeded
/** 1.对题分析,要让转化次数越大,则先从最小开始。 2.对一个数的x质数,最多能分为多少个不同的数 3.只需求到根号n以内的变化值 **/ #include <cstdio> #include <iostream> using namespace std; typedef long long ll; int solve(int x) { // 计算以i为底,以x为指数一共有多少不同的值 int now = 1, res = 0; while (now <= x) { x -= now; now++; res++; } return res; } int main() { ll n; int ans = 0; cin >> n; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { // 计算以i为底的指数为多少 n /= i; cnt++; } ans += solve(cnt); } } if (n != 1) ans++; cout << ans << endl; return 0; }
/** 1.对题分析,要让转化次数越大,则先从最小开始。 2.对一个数的x质数,最多能分为多少个不同的数 3.只需求到根号n以内的变化值 **/ #include <cstdio> #include <iostream> using namespace std; typedef long long ll; int solve(int x) { // 计算以i为底,以x为指数一共有多少不同的值 int now = 1, res = 0; while (now <= x) { x -= now; now++; res++; } return res; } int main() { ll n; int ans = 0; cin >> n; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { // 计算以i为底的指数为多少 n /= i; cnt++; } ans += solve(cnt); } } if (n != 1) ans++; cout << ans << endl; return 0; }
replace
22
23
22
23
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; using ld = long double; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ordered_set \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_order_statistics_node_update> #define endl "\n" #define pb push_back #define mp make_pair #define F first #define S second #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define pii 3.14159265358979323 #define inf LLONG_MAX #define ones(x) __builtin_popcount(x) #define fill(a, b) memset(a, b, sizeof(a)) #define mod 1000000007 ll mod_pow(ll a, ll b) { ll res = 1; while (b) { if (b & 1) { res = (res * a) % mod; } a = (a * a) % mod; b >>= 1; } return res; } ll mod_inverse(ll a) { return mod_pow(a, mod - 2); } void solve() { ll n; map<ll, ll> mp1; cin >> n; for (int i = 2; i * i <= n; ++i) { int cn = 0; while (n % i == 0) { cn++; n = n / i; } if (cn > 0) { mp1[i] = cn; } } if (n > 1) { mp1[n] = 1; } int tot = 0; for (auto u : mp1) { int cur = 1; int req = u.S; while (req >= cur) { req -= cur; cur++; tot++; } } cout << tot; } signed main() { fast; ll t; t = 1; // cin >> t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; using ld = long double; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ordered_set \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_order_statistics_node_update> #define endl "\n" #define pb push_back #define mp make_pair #define F first #define S second #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define pii 3.14159265358979323 #define inf LLONG_MAX #define ones(x) __builtin_popcount(x) #define fill(a, b) memset(a, b, sizeof(a)) #define mod 1000000007 ll mod_pow(ll a, ll b) { ll res = 1; while (b) { if (b & 1) { res = (res * a) % mod; } a = (a * a) % mod; b >>= 1; } return res; } ll mod_inverse(ll a) { return mod_pow(a, mod - 2); } void solve() { ll n; map<ll, ll> mp1; cin >> n; for (ll i = 2; i * i <= n; ++i) { int cn = 0; while (n % i == 0) { cn++; n = n / i; } if (cn > 0) { mp1[i] = cn; } } if (n > 1) { mp1[n] = 1; } int tot = 0; for (auto u : mp1) { int cur = 1; int req = u.S; while (req >= cur) { req -= cur; cur++; tot++; } } cout << tot; } signed main() { fast; ll t; t = 1; // cin >> t; while (t--) { solve(); } return 0; }
replace
53
54
53
54
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<pair<ll, int>> a; for (int i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; } a.emplace_back(i, x); } if (n != 1) a.emplace_back(n, 1); int ans = 0; for (auto i : a) { int x = 1; while (i.second - x >= 0) { i.second -= x; x++; ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<pair<ll, int>> a; for (ll i = 2; i * i <= n; i++) { int x = 0; while (n % i == 0) { n /= i; x++; } a.emplace_back(i, x); } if (n != 1) a.emplace_back(n, 1); int ans = 0; for (auto i : a) { int x = 1; while (i.second - x >= 0) { i.second -= x; x++; ans++; } } cout << ans << endl; return 0; }
replace
11
12
11
12
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int cnt[1000001]; int main() { long N, M; int ans = 0; cin >> N; M = N; if (N == 1) { cout << 0 << endl; return 0; } for (int i = 2; i < sqrt((double)N) + 1; i++) { if (N % i) continue; while (N % i == 0) { cnt[i]++; N /= i; } } if (N == M) { cout << 1 << endl; return 0; } cnt[N]++; for (int i = 2; i < 1000001; i++) { if (cnt[i] == 0) continue; int time = 1; while (time <= cnt[i]) { ans++; cnt[i] -= time; time++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int cnt[1000001]; int main() { long N, M; int ans = 0; cin >> N; M = N; if (N == 1) { cout << 0 << endl; return 0; } for (int i = 2; i < sqrt((double)N) + 1; i++) { if (N % i) continue; while (N % i == 0) { cnt[i]++; N /= i; } } if (N == M) { cout << 1 << endl; return 0; } if (N != 1) ans++; for (int i = 2; i < 1000001; i++) { if (cnt[i] == 0) continue; int time = 1; while (time <= cnt[i]) { ans++; cnt[i] -= time; time++; } } cout << ans << endl; return 0; }
replace
25
26
25
27
0
p02660
C++
Time Limit Exceeded
#include <iostream> #include <math.h> #include <set> #include <vector> using namespace std; set<int64_t> ans; void decomPrime(int num) { int n = 2; while (num > n * n) { while (num % n == 0) { num /= n; cout << n << ","; ans.insert(n); } n++; } cout << num << endl; ans.insert(num); } vector<pair<int64_t, int>> decomPrime2(int64_t num) { vector<pair<int64_t, int>> ret; int n = 2; while (num >= n * n) { int a = 0; while (num % n == 0) { num /= n; a++; // cout << n << ","; } if (a != 0) ret.emplace_back(n, a); n++; } // cout << num << endl; if (num != 1) ret.emplace_back(num, 1); // ans.insert(num); return ret; } bool isPri(int64_t num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } vector<int64_t> vec; bool element(int64_t i) { for (auto a : vec) { if (i == a) return true; } return false; } int64_t func(int64_t N) { int64_t z; for (int64_t i = 2; i <= N; i++) { if (isPri(i)) { z = 1; while (z <= N) { z *= i; if (N % z == 0) { if (element(z)) { continue; } return z; } } } } return 0; } int main() { int64_t N; int64_t z; cin >> N; // int count = 0; /* while ((z = func(N)) != 0) { count++; N /= z; vec.push_back(z); } cout << count; */ int ans = 0; for (auto p : decomPrime2(N)) { // cout << p.first << "," << p.second << endl; int n = p.second; int x = 1; while (n >= x) { ans++; n -= x; x++; } } cout << ans; // cin >> N; return 0; }
#include <iostream> #include <math.h> #include <set> #include <vector> using namespace std; set<int64_t> ans; void decomPrime(int num) { int n = 2; while (num > n * n) { while (num % n == 0) { num /= n; cout << n << ","; ans.insert(n); } n++; } cout << num << endl; ans.insert(num); } vector<pair<int64_t, int>> decomPrime2(int64_t num) { vector<pair<int64_t, int>> ret; int n = 2; while (sqrt(num) >= n) { int a = 0; while (num % n == 0) { num /= n; a++; // cout << n << ","; } if (a != 0) ret.emplace_back(n, a); n++; } // cout << num << endl; if (num != 1) ret.emplace_back(num, 1); // ans.insert(num); return ret; } bool isPri(int64_t num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } vector<int64_t> vec; bool element(int64_t i) { for (auto a : vec) { if (i == a) return true; } return false; } int64_t func(int64_t N) { int64_t z; for (int64_t i = 2; i <= N; i++) { if (isPri(i)) { z = 1; while (z <= N) { z *= i; if (N % z == 0) { if (element(z)) { continue; } return z; } } } } return 0; } int main() { int64_t N; int64_t z; cin >> N; // int count = 0; /* while ((z = func(N)) != 0) { count++; N /= z; vec.push_back(z); } cout << count; */ int ans = 0; for (auto p : decomPrime2(N)) { // cout << p.first << "," << p.second << endl; int n = p.second; int x = 1; while (n >= x) { ans++; n -= x; x++; } } cout << ans; // cin >> N; return 0; }
replace
29
30
29
30
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define ll int64_t #define _GLIBCXX_DEBUG const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { ll n; cin >> n; vector<int> v(1000004, 1); int ans = 0; for (int i = 1; i < 1000000; i++) { if (i + 1 > n) break; if (v.at(i) == 0) continue; int a = i + 1; if ((n % a) == 0) { ans++; n = n / a; if (v.at(i) == 2) continue; for (int j = 1; j <= 1000000 / a; j++) { if (a * j - 1 < 1000000) v.at(a * j - 1) = 0; } ll h = a * a; while (h < 1000000) { v.at(h - 1) = 2; h *= a; } } } if (n > 1000000) ans++; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define ll int64_t #define _GLIBCXX_DEBUG const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { ll n; cin >> n; vector<int> v(1000004, 1); int ans = 0; for (int i = 1; i < 1000000; i++) { if (i + 1 > n) break; if (v.at(i) == 0) continue; int a = i + 1; if ((n % a) == 0) { ans++; n = n / a; if (v.at(i) == 2) continue; for (int j = 1; j <= 1000000 / a; j++) { if (a * j - 1 < 1000000) v.at(a * j - 1) = 0; } ll h = a * a; while (1 <= h && h < 1000000) { v.at(h - 1) = 2; h *= a; } } } if (n > 1000000) ans++; cout << ans << endl; }
replace
29
30
29
30
0
p02660
C++
Runtime Error
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define mod 1000000007 int getTheAnswer() { return 42; } using namespace std; using ll = long long; int a[1000005]; class DDivGame { public: bool check(ll a, vector<int> &v) { for (int i = 0; i < v.size() && v[i] <= a; i++) { if (a % v[i] == 0) { while (a % v[i] == 0) a /= v[i]; if (a != 1) return false; return true; } } } void sieve(vector<int> &v) { a[0] = a[1] = 1; for (ll i = 2; i < 1000005; i++) { if (a[i] == 0) { v.pb(i); for (ll j = i * i; j < 1000005; j += i) a[j] = 1; } } } void solve(std::istream &cin, std::ostream &cout) { ll n; cin >> n; vector<ll> v; for (int i = 2; i < sqrt(n) + 1; i++) if (n % i == 0) { v.pb(i); v.pb(n / i); } if (v.size() == 0) { if (n == 1) cout << 0; else cout << 1 << endl; return; } sort(v.begin(), v.end()); vector<int> fact; sieve(fact); int cnt = 0; for (int i = 0; i < v.size() && n > 1; i++) { if ((n % v[i] == 0) && check(v[i], fact)) { // cout<<"val="<<v[i]<<endl; // cout<<"n="<<n<<endl; n /= v[i]; cnt++; } } cout << cnt; } }; int main() { DDivGame solver; std::ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define mod 1000000007 int getTheAnswer() { return 42; } using namespace std; using ll = long long; int a[1000005]; class DDivGame { public: bool check(ll a, vector<int> &v) { for (int i = 0; i < v.size() && v[i] <= a; i++) { if (a % v[i] == 0) { while (a % v[i] == 0) a /= v[i]; if (a != 1) return false; return true; } } return true; } void sieve(vector<int> &v) { a[0] = a[1] = 1; for (ll i = 2; i < 1000005; i++) { if (a[i] == 0) { v.pb(i); for (ll j = i * i; j < 1000005; j += i) a[j] = 1; } } } void solve(std::istream &cin, std::ostream &cout) { ll n; cin >> n; vector<ll> v; for (int i = 2; i < sqrt(n) + 1; i++) if (n % i == 0) { v.pb(i); v.pb(n / i); } if (v.size() == 0) { if (n == 1) cout << 0; else cout << 1 << endl; return; } sort(v.begin(), v.end()); vector<int> fact; sieve(fact); int cnt = 0; for (int i = 0; i < v.size() && n > 1; i++) { if ((n % v[i] == 0) && check(v[i], fact)) { // cout<<"val="<<v[i]<<endl; // cout<<"n="<<n<<endl; n /= v[i]; cnt++; } } cout << cnt; } }; int main() { DDivGame solver; std::ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
insert
30
30
30
31
0
p02660
C++
Time Limit Exceeded
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define Q \ int t; \ scanf("%d", &t); \ for (int q = 1; q <= t; q++) typedef long long int lli; typedef pair<int, int> pi; #define oset \ tree<lli, null_type, less<lli>, rb_tree_tag, \ tree_order_statistics_node_update> #define ff first #define ss second int main() { lli n; cin >> n; map<lli, lli> mp; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n != 1) mp[n]++; lli ans = 0; for (auto el : mp) { lli x = 1; while (el.ss >= x) { ans++; el.ss -= x; x++; } } cout << ans << "\n"; }
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define Q \ int t; \ scanf("%d", &t); \ for (int q = 1; q <= t; q++) typedef long long int lli; typedef pair<int, int> pi; #define oset \ tree<lli, null_type, less<lli>, rb_tree_tag, \ tree_order_statistics_node_update> #define ff first #define ss second int main() { lli n; cin >> n; map<lli, lli> mp; for (lli i = 2; i * i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n != 1) mp[n]++; lli ans = 0; for (auto el : mp) { lli x = 1; while (el.ss >= x) { ans++; el.ss -= x; x++; } } cout << ans << "\n"; }
replace
26
27
26
27
TLE
p02660
C++
Time Limit Exceeded
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef long long LL; const int e[40] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8}; const LL UnUseMethod = 1e6; LL count[2] = {0}; LL IN(void) { LL x = 0; short f = 0, c = getchar(); while (c < 48 || c > 57) { f ^= c == 45, c = getchar(); } while (c > 47 && c < 58) { x = x * 10 + c - 48, c = getchar(); } return f ? -x : x; } LL GCD(LL a, LL b) { return !b ? a : GCD(b, a % b); } LL Mult(LL x, LL y, LL mod) { LL temp = x * y - (LL)((long double)x / mod * y + 1e-8) * mod; return temp < 0 ? temp + mod : temp; } LL BinaryModularPower(LL base, LL pow, LL mod) { LL x = 1; while (pow) { if (pow & 1) { x = Mult(x, base, mod); } base = Mult(base, base, mod); pow >>= 1; } return x; } LL f(LL x, LL mod, LL c) { return (Mult(x, x, mod) + c) % x + 1; } void Exp(LL x, LL y) { count[1] = 0; while (!(x % y)) { count[1]++; x /= y; } count[0] = x; return; } int MillerRabin(const LL a) { if (a == 2) return 1; if (a % 2 == 0 || a == 1) return 0; static int pr[7] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}; LL u = a - 1, t = 0, p = 1; while (!(u & 1)) { u >>= 1; t++; } for (int i = 0; i < 7; ++i) { p = pr[i] % a; if (!p) return 1; LL x = BinaryModularPower(p, u, a); if (x == 1) continue; for (int j = 0; x != a - 1 && j < t; ++j) { x = Mult(x, x, a); if (x == 1) return 0; } if (x == a - 1) continue; return 0; } return 1; } LL PollardRho(LL n, LL a) { srand((unsigned int)time(NULL)); LL x = rand() % n, y = x, gcd = 1, k = 0, i = 1; while (gcd == 1) { k++; x = Mult(x, x, n) + a; if (x >= n) x -= n; gcd = GCD(x > y ? x - y : y - x, n); if (k == i) { y = x; i <<= 1; } } if (gcd == n) return PollardRho(n, a + 1); return gcd; } int main(void) { LL a = 0, p = 1, q = -1, N = IN(); if (N <= 1) return puts("0"), 0; Exp(N, 2); a = e[count[1]]; N = count[0]; Exp(N, 3); a += e[count[1]]; N = count[0]; while (q * q <= UnUseMethod) { p += 6, q += 6; Exp(N, p); a += e[count[1]]; N = count[0]; Exp(N, q); a += e[count[1]]; N = count[0]; } if (N <= UnUseMethod) { if (N > 1) { a++; } return printf("%lld\n", a), 0; } if (MillerRabin(N)) { a++; return printf("%lld\n", a), 0; } while (N >= UnUseMethod) { p = PollardRho(N, 0); while (!MillerRabin(p)) p = PollardRho(p, p); Exp(N, p); a += e[count[1]]; N = count[0]; } if (MillerRabin(N)) { a++; } return printf("%lld\n", a), 0; }
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef long long LL; const int e[40] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8}; const LL UnUseMethod = 10e10; LL count[2] = {0}; LL IN(void) { LL x = 0; short f = 0, c = getchar(); while (c < 48 || c > 57) { f ^= c == 45, c = getchar(); } while (c > 47 && c < 58) { x = x * 10 + c - 48, c = getchar(); } return f ? -x : x; } LL GCD(LL a, LL b) { return !b ? a : GCD(b, a % b); } LL Mult(LL x, LL y, LL mod) { LL temp = x * y - (LL)((long double)x / mod * y + 1e-8) * mod; return temp < 0 ? temp + mod : temp; } LL BinaryModularPower(LL base, LL pow, LL mod) { LL x = 1; while (pow) { if (pow & 1) { x = Mult(x, base, mod); } base = Mult(base, base, mod); pow >>= 1; } return x; } LL f(LL x, LL mod, LL c) { return (Mult(x, x, mod) + c) % x + 1; } void Exp(LL x, LL y) { count[1] = 0; while (!(x % y)) { count[1]++; x /= y; } count[0] = x; return; } int MillerRabin(const LL a) { if (a == 2) return 1; if (a % 2 == 0 || a == 1) return 0; static int pr[7] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}; LL u = a - 1, t = 0, p = 1; while (!(u & 1)) { u >>= 1; t++; } for (int i = 0; i < 7; ++i) { p = pr[i] % a; if (!p) return 1; LL x = BinaryModularPower(p, u, a); if (x == 1) continue; for (int j = 0; x != a - 1 && j < t; ++j) { x = Mult(x, x, a); if (x == 1) return 0; } if (x == a - 1) continue; return 0; } return 1; } LL PollardRho(LL n, LL a) { srand((unsigned int)time(NULL)); LL x = rand() % n, y = x, gcd = 1, k = 0, i = 1; while (gcd == 1) { k++; x = Mult(x, x, n) + a; if (x >= n) x -= n; gcd = GCD(x > y ? x - y : y - x, n); if (k == i) { y = x; i <<= 1; } } if (gcd == n) return PollardRho(n, a + 1); return gcd; } int main(void) { LL a = 0, p = 1, q = -1, N = IN(); if (N <= 1) return puts("0"), 0; Exp(N, 2); a = e[count[1]]; N = count[0]; Exp(N, 3); a += e[count[1]]; N = count[0]; while (q * q <= UnUseMethod) { p += 6, q += 6; Exp(N, p); a += e[count[1]]; N = count[0]; Exp(N, q); a += e[count[1]]; N = count[0]; } if (N <= UnUseMethod) { if (N > 1) { a++; } return printf("%lld\n", a), 0; } if (MillerRabin(N)) { a++; return printf("%lld\n", a), 0; } while (N >= UnUseMethod) { p = PollardRho(N, 0); while (!MillerRabin(p)) p = PollardRho(p, p); Exp(N, p); a += e[count[1]]; N = count[0]; } if (MillerRabin(N)) { a++; } return printf("%lld\n", a), 0; }
replace
6
7
6
7
TLE
p02660
C++
Time Limit Exceeded
#include <stdio.h> typedef long long LL; const int e[40] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8}; LL IN(void) { LL x = 0; short f = 0, c = getchar(); while (c < 48 || c > 57) f ^= c == 45, c = getchar(); while (c > 47 && c < 58) x = x * 10 + c - 48, c = getchar(); return f ? -x : x; } int main(void) { int x = 0; LL a = 0, i, N = IN(); while (N % 2 == 0) { x++; N /= 2; } a += e[x], x = 0; while (N % 3 == 0) { x++; N /= 3; } a += e[x], x = 0; while (N % 5 == 0) { x++; N /= 5; } a += e[x]; for (i = 0; i * i <= N; i += 6) { x = 0; while (N % (i + 1) == 0) { x++, N /= i + 1; } a += e[x]; x = 0; while (N % (i + 5) == 0) { x++, N /= i + 5; } a += e[x]; } if (N > 1) a++; return printf("%lld\n", a), 0; }
#include <stdio.h> typedef long long LL; const int e[40] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8}; LL IN(void) { LL x = 0; short f = 0, c = getchar(); while (c < 48 || c > 57) f ^= c == 45, c = getchar(); while (c > 47 && c < 58) x = x * 10 + c - 48, c = getchar(); return f ? -x : x; } int main(void) { int x = 0; LL a = 0, i, N = IN(); while (N % 2 == 0) { x++; N /= 2; } a += e[x], x = 0; while (N % 3 == 0) { x++; N /= 3; } a += e[x], x = 0; while (N % 5 == 0) { x++; N /= 5; } a += e[x]; for (i = 6; i * i <= N; i += 6) { x = 0; while (N % (i + 1) == 0) { x++, N /= i + 1; } a += e[x]; x = 0; while (N % (i + 5) == 0) { x++, N /= i + 5; } a += e[x]; } if (N > 1) a++; return printf("%lld\n", a), 0; }
replace
31
32
31
32
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; const int maxn = 500050; const int inf = 0x3f3f3f3f; const int mod = 998244353; const ll linf = 7e18; ll power(ll x, ll y) { ll ans = 1; while (y) { if (y & 1) ans = ans * x % mod; x = x * x % mod; y >>= 1; } return ans; } ll gcd(ll x, ll y) { if (x % y == 0) return y; return gcd(y, x % y); } int main() { ios::sync_with_stdio(0); cin.tie(0); int i, j, k = 0; ll n; cin >> n; for (i = 2; i * i <= n; i++) { j = 0; while (n % i == 0) { n /= i; j++; } int cnt = 1; while (j >= cnt) { j -= cnt; cnt++; k++; } } if (n != 1) k++; cout << k << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; const int maxn = 500050; const int inf = 0x3f3f3f3f; const int mod = 998244353; const ll linf = 7e18; ll power(ll x, ll y) { ll ans = 1; while (y) { if (y & 1) ans = ans * x % mod; x = x * x % mod; y >>= 1; } return ans; } ll gcd(ll x, ll y) { if (x % y == 0) return y; return gcd(y, x % y); } int main() { ios::sync_with_stdio(0); cin.tie(0); int j, k = 0; ll n, i; cin >> n; for (i = 2; i * i <= n; i++) { j = 0; while (n % i == 0) { n /= i; j++; } int cnt = 1; while (j >= cnt) { j -= cnt; cnt++; k++; } } if (n != 1) k++; cout << k << "\n"; return 0; }
replace
29
31
29
31
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define REP(i, n) for (long long i = 0; i < n; i++) #define REPR(i, n) for (long long i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (long long i = m; i <= n; i++) #define FORR(i, m, n) for (long long i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define VSORTR(v) sort(v.rbegin(), v.rend()); #define ALL(v) (v).begin(), (v).end() #define FIN \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using P = pair<ll, ll>; const ll mod = 1e9 + 7; const ll inf = 1e15; map<ll, ll> primes(ll n) { map<ll, ll> r; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { r[i]++; n /= i; } } if (n != 1) r[n] = 1; r[1] = 0; return r; } int main() { FIN ll n, k = 0; ; cin >> n; ll i; map<ll, ll> v; v = primes(n); for (i = 2; i * i <= n; i++) { // cout<<i<<" "; if (n % i == 0) { k = 0; while (n % i == 0) { n /= i; k++; // cout<<i<<" "<<n<<"\n"; } v[i] = k; } } // cout<<endl<<i<<endl; ll ans = 0; for (auto i : v) { ll p = sqrt(1 + 8 * i.second) - 1; p /= 2; ans += p; } cout << ans; return 0; }
#include <bits/stdc++.h> #define REP(i, n) for (long long i = 0; i < n; i++) #define REPR(i, n) for (long long i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (long long i = m; i <= n; i++) #define FORR(i, m, n) for (long long i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define VSORTR(v) sort(v.rbegin(), v.rend()); #define ALL(v) (v).begin(), (v).end() #define FIN \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using P = pair<ll, ll>; const ll mod = 1e9 + 7; const ll inf = 1e15; map<ll, ll> primes(ll n) { map<ll, ll> r; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { r[i]++; n /= i; } } if (n != 1) r[n] = 1; r[1] = 0; return r; } int main() { FIN ll n, k = 0; ; cin >> n; ll i; map<ll, ll> v; v = primes(n); for (i = 2; i * i <= n; i++) { // cout<<i<<" "; if (n % i == 0) { k = 0; while (n % i == 0) { n /= i; k++; // cout<<i<<" "<<n<<"\n"; } v[i] = k; } } // cout<<endl<<i<<endl; ll ans = 0; for (auto i : v) { ll p = sqrt(1 + 8 * i.second) - 1; p /= 2; ans += p; } cout << ans; return 0; }
replace
24
25
24
25
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { ll N; cin >> N; vector<bool> prime(1000001, true); prime[0] = false; prime[1] = false; for (ll i = 2; i * i < 1000001; i++) { if (!prime[i]) continue; for (ll j = 2 * i; j < 1000001; j += i) { prime[j] = false; } } vector<ll> primes; rep(i, 1000001) { if (prime[i]) primes.push_back(i); } // rep(i, 100) cout << primes[i] << " "; // cout << "\n" << primes.back() << "\n"; ll ans = 0; rep(i, 1000001) { ll p = primes[i]; if (p * p > N) break; if (N % p != 0) continue; int c = 0; while (N % p == 0) { N /= p; c++; } rep(j, 1000001) { if (c > j) { ans++; c -= j + 1; } else { break; } } } if (N > 1) ans++; cout << ans << "\n"; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { ll N; cin >> N; vector<bool> prime(1000001, true); prime[0] = false; prime[1] = false; for (ll i = 2; i * i < 1000001; i++) { if (!prime[i]) continue; for (ll j = 2 * i; j < 1000001; j += i) { prime[j] = false; } } vector<ll> primes; rep(i, 1000001) { if (prime[i]) primes.push_back(i); } // rep(i, 100) cout << primes[i] << " "; // cout << "\n" << primes.back() << "\n"; ll ans = 0; rep(i, primes.size()) { ll p = primes[i]; if (p * p > N) break; if (N % p != 0) continue; int c = 0; while (N % p == 0) { N /= p; c++; } rep(j, 1000001) { if (c > j) { ans++; c -= j + 1; } else { break; } } } if (N > 1) ans++; cout << ans << "\n"; }
replace
27
28
27
28
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> PP; #define MOD 1000000007 // #define MOD 998244353 #define INF 1145141919810893364 // #define INF 810114514 #define PI 3.141592653589 #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define OREP(i, n) for (int i = 1; i <= (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define GOODBYE \ do { \ cout << "0" << endl; \ return 0; \ } while (false) #define MM << " " << #define Endl endl #define debug false #define debug2 false // 素因数分解 std::vector<long long> prime_factorization(long long N) { std::vector<long long> R; if (N < 2) return R; for (int i = 2; i * i <= N; i++) { while (N % i == 0) { R.push_back(i); N /= i; } } if (N != 1) { R.push_back(N); } return R; } int main(void) { long long N; cin >> N; vector<long long> P = prime_factorization(N); map<long long, long long> M; REP(i, P.size()) { M[P[i]]++; } long long Ans = 0; REP(i, P.size()) { long long m = M[P[i]]; long long B = m; if (m == 0) continue; M[P[i]] = 0; for (long long k = 1; k <= B; k++) { if (m >= k) { Ans++; m -= k; } else { break; } } } cout << Ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> PP; #define MOD 1000000007 // #define MOD 998244353 #define INF 1145141919810893364 // #define INF 810114514 #define PI 3.141592653589 #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define OREP(i, n) for (int i = 1; i <= (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define GOODBYE \ do { \ cout << "0" << endl; \ return 0; \ } while (false) #define MM << " " << #define Endl endl #define debug false #define debug2 false // 素因数分解 std::vector<long long> prime_factorization(long long N) { std::vector<long long> R; if (N < 2) return R; for (long long i = 2; i * i <= N; i++) { while (N % i == 0) { R.push_back(i); N /= i; } } if (N != 1) { R.push_back(N); } return R; } int main(void) { long long N; cin >> N; vector<long long> P = prime_factorization(N); map<long long, long long> M; REP(i, P.size()) { M[P[i]]++; } long long Ans = 0; REP(i, P.size()) { long long m = M[P[i]]; long long B = m; if (m == 0) continue; M[P[i]] = 0; for (long long k = 1; k <= B; k++) { if (m >= k) { Ans++; m -= k; } else { break; } } } cout << Ans << endl; return 0; }
replace
28
29
28
29
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<ll, ll>; vector<pair<ll, int>> factor(ll n) { vector<pair<ll, int>> res; for (ll i; i * i <= n; i++) { if (n % i != 0) continue; int ex = 0; while (n % i == 0) { ex++; n /= i; } res.push_back({i, ex}); } if (n != 1) res.push_back({n, 1}); return res; } int main() { ll n; cin >> n; int ans = 0; vector<pair<ll, int>> fs; fs = factor(n); for (auto p : fs) { int x = p.second; int b = 1; while (b <= x) { x -= b; b++; ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<ll, ll>; vector<pair<ll, int>> factor(ll n) { vector<pair<ll, int>> res; for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; int ex = 0; while (n % i == 0) { ex++; n /= i; } res.push_back({i, ex}); } if (n != 1) res.push_back({n, 1}); return res; } int main() { ll n; cin >> n; int ans = 0; vector<pair<ll, int>> fs; fs = factor(n); for (auto p : fs) { int x = p.second; int b = 1; while (b <= x) { x -= b; b++; ans++; } } cout << ans << endl; return 0; }
replace
10
11
10
11
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; int calc(int n) { for (int i = 1;; i++) { if (i * (i + 1) > n * 2) return i - 1; } } vector<pair<ll, int>> prime_factorize(ll n) { vector<pair<ll, int>> vp; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } vp.push_back({i, cnt}); } } if (n != 1) vp.push_back({n, 1}); return vp; } int main() { ll n; cin >> n; vector<pair<ll, int>> vp = prime_factorize(n); int ans = 0; for (int i = 0; i < vp.size(); i++) ans += calc(vp[i].second); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int calc(int n) { for (int i = 1;; i++) { if (i * (i + 1) > n * 2) return i - 1; } } vector<pair<ll, int>> prime_factorize(ll n) { vector<pair<ll, int>> vp; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } vp.push_back({i, cnt}); } } if (n != 1) vp.push_back({n, 1}); return vp; } int main() { ll n; cin >> n; vector<pair<ll, int>> vp = prime_factorize(n); int ans = 0; for (int i = 0; i < vp.size(); i++) ans += calc(vp[i].second); cout << ans << endl; }
replace
13
14
13
14
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll n; cin >> n; vector<pair<int, int>> prime; int ans = 0; for (int i = 2; i * i <= n; i++) { int cnt = 0; if (n % i == 0) { while (n % i == 0) { cnt++; n /= i; } for (int j = 1;; j++) { cnt -= j; if (cnt >= 0) ans++; else break; } } } if (n != 1) ans++; cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll n; cin >> n; vector<pair<int, int>> prime; int ans = 0; for (ll i = 2; i * i <= n; i++) { int cnt = 0; if (n % i == 0) { while (n % i == 0) { cnt++; n /= i; } for (int j = 1;; j++) { cnt -= j; if (cnt >= 0) ans++; else break; } } } if (n != 1) ans++; cout << ans << endl; }
replace
25
26
25
26
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long n; long long ii; long kotae; int i; int j; int k; int a[66]; k = 1; a[0] = 0; a[1] = 0; for (i = 1; i < 11; i++) { a[k] = a[k - 1] + 1; k++; for (j = 0; j < i; j++) { a[k] = a[k - 1]; k++; } } cin >> n; kotae = 0; for (ii = 2; i < 1000001; ii++) { i = 0; while (n > 0) { // iiで割り切れなければループを抜ける if (n % ii > 0) { break; } n = n / ii; i++; } kotae = kotae + a[i]; if (ii > n) { break; } } if (n > 1) kotae++; cout << kotae << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n; long long ii; long kotae; int i; int j; int k; int a[66]; k = 1; a[0] = 0; a[1] = 0; for (i = 1; i < 11; i++) { a[k] = a[k - 1] + 1; k++; for (j = 0; j < i; j++) { a[k] = a[k - 1]; k++; } } cin >> n; kotae = 0; for (ii = 2; i < 1000001; ii++) { i = 0; while (n > 0) { // iiで割り切れなければループを抜ける if (n % ii > 0) { break; } n = n / ii; i++; } kotae = kotae + a[i]; if (ii * ii > n) { break; } } if (n > 1) kotae++; cout << kotae << endl; return 0; }
replace
39
40
39
40
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define pb push_back #define mp make_pair typedef long long ll; typedef pair<int, int> pii; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; // unordered_map<ll, int> count; // count.reserve(1024); vector<pair<ll, int>> factors; ll ans = 0; for (int i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; // ans = max(ans, count[i]); // ans -= count[i]/2; // ans += (count[i]+1)/2; n /= i; // factors.pb(i); } factors.pb(mp(i, cnt)); } if (n != 1) { factors.pb(mp(n, 1)); // count[n]++; // ans += 1; } for (auto it : factors) { int times = it.s; // int times = count[it]; int curr = 1; while (times - curr >= 0) { times -= curr; curr++; ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define pb push_back #define mp make_pair typedef long long ll; typedef pair<int, int> pii; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; // unordered_map<ll, int> count; // count.reserve(1024); vector<pair<ll, int>> factors; ll ans = 0; for (ll i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; // ans = max(ans, count[i]); // ans -= count[i]/2; // ans += (count[i]+1)/2; n /= i; // factors.pb(i); } factors.pb(mp(i, cnt)); } if (n != 1) { factors.pb(mp(n, 1)); // count[n]++; // ans += 1; } for (auto it : factors) { int times = it.s; // int times = count[it]; int curr = 1; while (times - curr >= 0) { times -= curr; curr++; ans++; } } cout << ans << endl; }
replace
19
20
19
20
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif long long int n; cin >> n; long long int ans = 0; for (long long int i = 0; i * i <= n; i++) { if (n % i != 0) continue; long long int num = 0; while (n % i == 0) { n /= i; num += 1; } for (long long int j = 1;; j++) { if (num >= j) { num -= j; ans += 1; } else break; } } if (n != 1) { ans += 1; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif long long int n; cin >> n; long long int ans = 0; for (long long int i = 2; i * i <= n; i++) { if (n % i != 0) continue; long long int num = 0; while (n % i == 0) { n /= i; num += 1; } for (long long int j = 1;; j++) { if (num >= j) { num -= j; ans += 1; } else break; } } if (n != 1) { ans += 1; } cout << ans << endl; return 0; }
replace
16
17
16
17
-8
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define loop(n, i, a) for (ll i = a; i < n; i++) #define loopR(n, i, a) for (ll i = n - 1; i >= a; i--) #define all(arr, n) arr, arr + n #define allv(v) (v).begin(), (v).end() #define rallv(v) (v).rbegin(), (v).rend() #define m_p make_pair #define ll long long #define pii pair<ll, ll> #define vi vector<int> #define vll vector<ll> #define vii vector<pair<ll, ll>> #define sz(x) (int)x.size() #define pb push_back #define endl "\n" #define Endl "\n" #define f first #define s second #define mem(dp, n) memset(dp, n, sizeof dp) int dx[] = {1, 0, -1, 0, -1, -1, 1, 1}; int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; int KnightI[] = {2, 1, -1, -2, -2, -1, 1, 2}; int KnightJ[] = {1, 2, 2, 1, -1, -2, -2, -1}; template <typename T> void max_self(T &a, T b) { a = max(a, b); } template <typename T> void min_self(T &a, T b) { a = min(a, b); } void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, __attribute__((unused)) int idx, __attribute__((unused)) int LINE_NUM) { cerr << endl; } template <typename Head, typename... Tail> void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) { if (idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H; cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...); } #define debug(...) \ debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__) const ll mxN = 5e5 + 10, oo = 0x3f3f3f3f, MOD = 998244353; const double PI = acos(-1); void solve() { ll n; cin >> n; map<ll, ll> mp; for (int i = 2; i * i <= n; i++) { while (n % i == 0) mp[i]++, n /= i; } if (n > 1) mp[n]++; ll res = 0; for (auto x : mp) { ll cur = 0; loop(70, i, 1) { cur = i * (i + 1) / 2; if (cur == x.s) { res += i; break; } else if (cur > x.s) { res += (i - 1); break; } } } cout << res << endl; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif fast(); solve(); }
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define loop(n, i, a) for (ll i = a; i < n; i++) #define loopR(n, i, a) for (ll i = n - 1; i >= a; i--) #define all(arr, n) arr, arr + n #define allv(v) (v).begin(), (v).end() #define rallv(v) (v).rbegin(), (v).rend() #define m_p make_pair #define ll long long #define pii pair<ll, ll> #define vi vector<int> #define vll vector<ll> #define vii vector<pair<ll, ll>> #define sz(x) (int)x.size() #define pb push_back #define endl "\n" #define Endl "\n" #define f first #define s second #define mem(dp, n) memset(dp, n, sizeof dp) int dx[] = {1, 0, -1, 0, -1, -1, 1, 1}; int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; int KnightI[] = {2, 1, -1, -2, -2, -1, 1, 2}; int KnightJ[] = {1, 2, 2, 1, -1, -2, -2, -1}; template <typename T> void max_self(T &a, T b) { a = max(a, b); } template <typename T> void min_self(T &a, T b) { a = min(a, b); } void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, __attribute__((unused)) int idx, __attribute__((unused)) int LINE_NUM) { cerr << endl; } template <typename Head, typename... Tail> void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) { if (idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H; cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...); } #define debug(...) \ debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__) const ll mxN = 5e5 + 10, oo = 0x3f3f3f3f, MOD = 998244353; const double PI = acos(-1); void solve() { ll n; cin >> n; map<ll, ll> mp; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) mp[i]++, n /= i; } if (n > 1) mp[n]++; ll res = 0; for (auto x : mp) { ll cur = 0; loop(70, i, 1) { cur = i * (i + 1) / 2; if (cur == x.s) { res += i; break; } else if (cur > x.s) { res += (i - 1); break; } } } cout << res << endl; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif fast(); solve(); }
replace
85
86
85
86
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; using ll = long long; const int INF = 1001001001; int fun(int x) { int ans = 0; for (int i = 1;; i++) { ans += i; if (ans == x) return i; else if (x < ans) return i - 1; } } int main() { ll n; cin >> n; ll half = sqrt(n); int ans = 0; for (int i = 0; i < half; i++) { int a = 0; while (n % i == 0) { a++; n /= i; } ans += fun(a); } if (n > 1) cout << ans + 1 << endl; else cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; using ll = long long; const int INF = 1001001001; int fun(int x) { int ans = 0; for (int i = 1;; i++) { ans += i; if (ans == x) return i; else if (x < ans) return i - 1; } } int main() { ll n; cin >> n; ll half = sqrt(n); int ans = 0; if (n == 1) { cout << 0 << endl; return 0; } for (int i = 2; i < half; i++) { int a = 0; while (n % i == 0) { a++; n /= i; } ans += fun(a); } if (n > 1) cout << ans + 1 << endl; else cout << ans << endl; return 0; }
replace
23
24
23
28
-8
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long ll; #define pll pair<ll, ll> #define ff first #define snd second #define pb push_back #define vll vector<ll> #define vpll vector<pll> #define endl "\n" #define MOD 1000000007 using namespace std; ll const N = 1e5 + 1; map<ll, ll> m; void prime(ll n) { while (n > 1 && n % 2 == 0) { n /= 2; m[2]++; } for (int i = 3; i * i <= n; i += 2) { while (n % i == 0) { n /= i; m[i]++; } } if (n > 2) m[n]++; } void solve() { ll n; cin >> n; if (n == 1) { cout << 0; return; } prime(n); ll ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { ll k = (*itr).ff; ll c_val = 1; while (m[k] > 0) { if (m[k] - c_val < c_val + 1) { ans++; break; } else { ans++; } m[k] -= c_val; c_val++; } } cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // cin>>t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> typedef long long ll; #define pll pair<ll, ll> #define ff first #define snd second #define pb push_back #define vll vector<ll> #define vpll vector<pll> #define endl "\n" #define MOD 1000000007 using namespace std; ll const N = 1e5 + 1; map<ll, ll> m; void prime(ll n) { while (n > 1 && n % 2 == 0) { n /= 2; m[2]++; } for (ll i = 3; i * i <= n; i += 2) { while (n % i == 0) { n /= i; m[i]++; } } if (n > 2) m[n]++; } void solve() { ll n; cin >> n; if (n == 1) { cout << 0; return; } prime(n); ll ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { ll k = (*itr).ff; ll c_val = 1; while (m[k] > 0) { if (m[k] - c_val < c_val + 1) { ans++; break; } else { ans++; } m[k] -= c_val; c_val++; } } cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // cin>>t; while (t--) { solve(); } return 0; }
replace
22
23
22
23
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<int> fc; for (int i = 2; i * i < N; i++) { if (N % i == 0) { int cnt = 0; while (N % i == 0) { cnt++; N /= i; } fc.push_back(cnt); } } if (N != 1) { fc.push_back(1); } int M = fc.size(); int ans = 0; for (int i = 0; i < M; i++) { int t = 0; int f = 10000; while (f - t > 1) { int m = (f + t) / 2; if (m * (m + 1) / 2 <= fc[i]) { t = m; } else { f = m; } } ans += t; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<int> fc; for (long long i = 2; i * i < N; i++) { if (N % i == 0) { int cnt = 0; while (N % i == 0) { cnt++; N /= i; } fc.push_back(cnt); } } if (N != 1) { fc.push_back(1); } int M = fc.size(); int ans = 0; for (int i = 0; i < M; i++) { int t = 0; int f = 10000; while (f - t > 1) { int m = (f + t) / 2; if (m * (m + 1) / 2 <= fc[i]) { t = m; } else { f = m; } } ans += t; } cout << ans << endl; }
replace
6
7
6
7
TLE
p02660
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int solve(long long n) { if (n == 1) { return 0; } vector<int> f; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { f.push_back(i); n /= i; } } if (n > 1) f.push_back(n); int ans = 0; int i = 0; while (i < f.size()) { int j = i + 1; while (j < f.size() && f.at(j) == f.at(i)) j++; int count = j - i; i = j; int sum = 0; for (int x = 1; count >= sum + x; x++, ans++) sum += x; } return ans; } int main() { long long n; cin >> n; cout << solve(n) << endl; }
#include <iostream> #include <vector> using namespace std; int solve(long long n) { if (n == 1) { return 0; } vector<long long> f; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { f.push_back(i); n /= i; } } if (n > 1) f.push_back(n); int ans = 0; int i = 0; while (i < f.size()) { int j = i + 1; while (j < f.size() && f.at(j) == f.at(i)) j++; int count = j - i; i = j; int sum = 0; for (int x = 1; count >= sum + x; x++, ans++) sum += x; } return ans; } int main() { long long n; cin >> n; cout << solve(n) << endl; }
replace
8
10
8
10
TLE
p02660
C++
Time Limit Exceeded
//----------------------- // author : xyqkoala // time : 2020-07-23 //----------------------- #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long LL; const int MOD = 1e9 + 7; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T = 1; // cin>>T; while (T--) { solve(); } return 0; } void solve() { LL n; cin >> n; unordered_map<int, int> t; for (int i = 2; i * i <= n; i++) { if (n % i) continue; while (n % i == 0) { n = n / i; t[i]++; } } if (n > 1) t[n]++; int res = 0; for (auto item : t) { int cnt = 2 * item.second; int tcnt = sqrt(cnt); if ((tcnt * (tcnt + 1) > cnt)) tcnt--; res += tcnt; } cout << res << endl; }
//----------------------- // author : xyqkoala // time : 2020-07-23 //----------------------- #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long LL; const int MOD = 1e9 + 7; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T = 1; // cin>>T; while (T--) { solve(); } return 0; } void solve() { LL n; cin >> n; unordered_map<int, int> t; for (LL i = 2; i * i <= n; i++) { if (n % i) continue; while (n % i == 0) { n = n / i; t[i]++; } } if (n > 1) t[n]++; int res = 0; for (auto item : t) { int cnt = 2 * item.second; int tcnt = sqrt(cnt); if ((tcnt * (tcnt + 1) > cnt)) tcnt--; res += tcnt; } cout << res << endl; }
replace
38
39
38
39
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define PI 3.14159265358979323846 #define vl vector<long long> using namespace std; using ll = long long; using ld = long double; // ----本問について---- // 問題: // 問題文URL: // ------------------ // ----ここから本問のソースコード---- // グローバル変数(入力) ll n; vector<pair<ll, ll>> primeFac(ll n) { vector<pair<ll, ll>> ans; ll index = -1; for (ll i = 2; i <= n; i++) { if (index == -1 && i > sqrt(n)) { ans.push_back(make_pair(n, 1)); break; } if (n % i == 0) { ans.push_back(make_pair(i, 0)); index++; } while (n % i == 0) { n /= i; ans[index].second++; } } return ans; } void solve() { vector<pair<ll, ll>> a = primeFac(n); ll ans = 0; rep(i, a.size()) { ll index = a[i].second; ll m = 0; while (index >= (m + 1) * (m + 2) / 2) { m++; } ans += m; // cout << "底:" << a[i].first << " 指数:" << index << " m:" << m << endl; } cout << ans << endl; } int main() { cin >> n; solve(); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) #define PI 3.14159265358979323846 #define vl vector<long long> using namespace std; using ll = long long; using ld = long double; // ----本問について---- // 問題: // 問題文URL: // ------------------ // ----ここから本問のソースコード---- // グローバル変数(入力) ll n; vector<pair<ll, ll>> primeFac(ll n) { vector<pair<ll, ll>> ans; ll index = -1; for (ll i = 2; i <= n; i++) { if (i > sqrt(n)) { ans.push_back(make_pair(n, 1)); break; } if (n % i == 0) { ans.push_back(make_pair(i, 0)); index++; } while (n % i == 0) { n /= i; ans[index].second++; } } return ans; } void solve() { vector<pair<ll, ll>> a = primeFac(n); ll ans = 0; rep(i, a.size()) { ll index = a[i].second; ll m = 0; while (index >= (m + 1) * (m + 2) / 2) { m++; } ans += m; // cout << "底:" << a[i].first << " 指数:" << index << " m:" << m << endl; } cout << ans << endl; } int main() { cin >> n; solve(); return 0; }
replace
22
23
22
23
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(a) a.begin(), a.end() #define pb push_back #define dame \ { \ puts("-1"); \ return 0; \ } #define show(x) cerr << #x << " = " << x << endl; using namespace std; using ll = long long; using ld = long double; using pl = pair<ll, ll>; typedef vector<ll> vl; typedef vector<pl> vp; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const ll mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } // combination mod prime // https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619 struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } } c(200005); ll LINF = 1000000000000000000; int main() { ll n; cin >> n; ll m = n; map<ll, ll> mp; bool flug = false; for (int i = 2; i * i <= m; i++) { while (m % i == 0) { m /= i; mp[i]++; } } if (m > 1) mp[m]++; ll ans = 0; for (auto x : mp) { // show(x.fi); // show(x.se); ll ind = 1; ll l = x.se; ll S = ind * (ind + 1) / 2; while (S <= l) { ind++; S = ind * (ind + 1) / 2; } show(ind - 1); ans += ind - 1; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(a) a.begin(), a.end() #define pb push_back #define dame \ { \ puts("-1"); \ return 0; \ } #define show(x) cerr << #x << " = " << x << endl; using namespace std; using ll = long long; using ld = long double; using pl = pair<ll, ll>; typedef vector<ll> vl; typedef vector<pl> vp; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const ll mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } // combination mod prime // https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619 struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } } c(200005); ll LINF = 1000000000000000000; int main() { ll n; cin >> n; ll m = n; map<ll, ll> mp; bool flug = false; for (int i = 2; i <= 1000000; i++) { while (m % i == 0) { m /= i; mp[i]++; } } if (m > 1) mp[m]++; ll ans = 0; for (auto x : mp) { // show(x.fi); // show(x.se); ll ind = 1; ll l = x.se; ll S = ind * (ind + 1) / 2; while (S <= l) { ind++; S = ind * (ind + 1) / 2; } show(ind - 1); ans += ind - 1; } cout << ans << endl; return 0; }
replace
109
110
109
110
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using Int = long long; int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0); // int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv // ./prog.exe") >> 8), 0); int main() { Int N; cin >> N; Int ans = 0; for (int p = 2; p * p <= N; p++) { int cnt = 0; while (N % p == 0) cnt++, N /= p; for (int i = 1; i <= cnt; i++) { ans += 1, cnt -= i; } } if (N != 1) ans += 1; cout << ans << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; using Int = long long; int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0); // int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv // ./prog.exe") >> 8), 0); int main() { Int N; cin >> N; Int ans = 0; for (Int p = 2; p * p <= N; p++) { int cnt = 0; while (N % p == 0) cnt++, N /= p; for (int i = 1; i <= cnt; i++) { ans += 1, cnt -= i; } } if (N != 1) ans += 1; cout << ans << '\n'; return 0; }
replace
11
12
11
12
TLE
p02660
C++
Runtime Error
// 高知能系Vtuberの高井茅乃です。 // Twitter: https://twitter.com/takaichino // YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw #include <bits/stdc++.h> using namespace std; typedef long long ll; #define INTINF 1999999999 #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i <= n; i++) #define MODA 1000000007 int main() { // エラトステネスの篩でP_max以下の素数vector primeをつくる bool *pr; ll P_max = 1000000; // 10^6くらいまでが現実的か pr = (bool *)malloc(sizeof(bool) * (P_max + 1)); REP(i, P_max + 1) pr[i] = true; pr[0] = false; pr[1] = false; for (ll i = 2; i * i <= P_max; i++) { if (pr[i] == true) { for (ll j = 2 * i; j <= P_max; j += i) { pr[j] = false; } } } vector<ll> prime; for (ll i = 2; i <= P_max; i++) { if (pr[i]) prime.push_back(i); } // ll n; cin >> n; // 整数Xの素因数分解の結果をmapで返す。上のvector primeはもちろんいる ll X = n; ll diving = X; // これをどんどん割っていく。dividingが正しい map<ll, ll> prf; for (ll i = 0; diving > 1 && prime[i] * prime[i] <= X; i++) { while (diving % prime[i] == 0) { diving /= prime[i]; prf[prime[i]]++; } } if (diving > 1) prf[diving]++; // これは素因数分解の結果が見たくなったときに使うもの // for(auto i = prf.begin(); i!= prf.end(); i++) cout << i->first << "," << // i->second << " "; cout << endl; // ll re = 0; ll ans = 0; for (auto i = prf.begin(); i != prf.end(); i++) { for (re = 1; re <= i->second; re++) { ans++; i->second -= re; } } cout << ans << endl; return 0; }
// 高知能系Vtuberの高井茅乃です。 // Twitter: https://twitter.com/takaichino // YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw #include <bits/stdc++.h> using namespace std; typedef long long ll; #define INTINF 1999999999 #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i <= n; i++) #define MODA 1000000007 int main() { // エラトステネスの篩でP_max以下の素数vector primeをつくる bool *pr; ll P_max = 2000000; // 10^6くらいまでが現実的か pr = (bool *)malloc(sizeof(bool) * (P_max + 1)); REP(i, P_max + 1) pr[i] = true; pr[0] = false; pr[1] = false; for (ll i = 2; i * i <= P_max; i++) { if (pr[i] == true) { for (ll j = 2 * i; j <= P_max; j += i) { pr[j] = false; } } } vector<ll> prime; for (ll i = 2; i <= P_max; i++) { if (pr[i]) prime.push_back(i); } // ll n; cin >> n; // 整数Xの素因数分解の結果をmapで返す。上のvector primeはもちろんいる ll X = n; ll diving = X; // これをどんどん割っていく。dividingが正しい map<ll, ll> prf; for (ll i = 0; diving > 1 && prime[i] * prime[i] <= X; i++) { while (diving % prime[i] == 0) { diving /= prime[i]; prf[prime[i]]++; } } if (diving > 1) prf[diving]++; // これは素因数分解の結果が見たくなったときに使うもの // for(auto i = prf.begin(); i!= prf.end(); i++) cout << i->first << "," << // i->second << " "; cout << endl; // ll re = 0; ll ans = 0; for (auto i = prf.begin(); i != prf.end(); i++) { for (re = 1; re <= i->second; re++) { ans++; i->second -= re; } } cout << ans << endl; return 0; }
replace
16
17
16
17
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>> vvll; template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; const int INT_INF = 1 << 30; const double PI = acos(-1.0); #define MOD 1000000007LL #define endl "\n" int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; vll fact(0); if (N == 1) { cout << 0 << endl; return 0; } for (int i = 2; i * i <= N; i++) { if (N % i == 0) { ll count = 0LL; while (N % i == 0) { N /= i; count++; } fact.push_back(count); } } if (N != 1) fact.push_back(1); sort(ALL(fact)); vector<P> num(0); for (int i = 0; i < sz(fact); i++) { if (i == 0) num.push_back(P(fact.at(i), 1)); else { int siz = num.size() - 1; if (num.at(siz).first == fact.at(i)) num.at(siz).second++; else num.push_back(P(fact.at(i), 1)); } } // for(auto x: mp) cout << x.first << ' ' << x.second << endl; vll box(0); ll sum = 0LL; for (int i = 1; i < 1000; i++) { sum += i; box.push_back(sum); } ll ans = 0LL; for (int i = 0; i < sz(num); i++) { ll n = num.at(i).first; ll c = num.at(i).second; ll x = upper_bound(ALL(box), n) - box.begin(); ans += x * c; } cout << ans << endl; }
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>> vvll; template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; const int INT_INF = 1 << 30; const double PI = acos(-1.0); #define MOD 1000000007LL #define endl "\n" int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; vll fact(0); if (N == 1) { cout << 0 << endl; return 0; } for (ll i = 2; i * i <= N; i++) { if (N % i == 0) { ll count = 0LL; while (N % i == 0) { N /= i; count++; } fact.push_back(count); } } if (N != 1) fact.push_back(1); sort(ALL(fact)); vector<P> num(0); for (int i = 0; i < sz(fact); i++) { if (i == 0) num.push_back(P(fact.at(i), 1)); else { int siz = num.size() - 1; if (num.at(siz).first == fact.at(i)) num.at(siz).second++; else num.push_back(P(fact.at(i), 1)); } } // for(auto x: mp) cout << x.first << ' ' << x.second << endl; vll box(0); ll sum = 0LL; for (int i = 1; i < 1000; i++) { sum += i; box.push_back(sum); } ll ans = 0LL; for (int i = 0; i < sz(num); i++) { ll n = num.at(i).first; ll c = num.at(i).second; ll x = upper_bound(ALL(box), n) - box.begin(); ans += x * c; } cout << ans << endl; }
replace
41
42
41
42
TLE
p02660
C++
Time Limit Exceeded
#include <iostream> #include <unordered_map> using namespace std; int main() { long long N; cin >> N; unordered_map<long long, int> factor; long long a = 2; long long N0 = N; if (N == 1) { cout << 0 << endl; return 0; } while (N > 1) { if (N % a == 0) { N /= a; factor[a] += 1; } else { a++; if (N0 < a * a) { a = N0; } } } int count = 0; for (const auto &f : factor) { int e_sum = f.second; int e = 1; while (true) { if (e_sum >= e) { count++; e_sum -= e; e++; } else { break; } } } cout << count << endl; return 0; }
#include <iostream> #include <unordered_map> using namespace std; int main() { long long N; cin >> N; unordered_map<long long, int> factor; long long a = 2; long long N0 = N; if (N == 1) { cout << 0 << endl; return 0; } while (N > 1) { if (N % a == 0) { N /= a; factor[a] += 1; } else { a++; if (N < a * a) { a = N; } } } int count = 0; for (const auto &f : factor) { int e_sum = f.second; int e = 1; while (true) { if (e_sum >= e) { count++; e_sum -= e; e++; } else { break; } } } cout << count << endl; return 0; }
replace
27
29
27
29
TLE
p02660
C++
Time Limit Exceeded
/* "Won't stop untill I'm Phenomenal" - Phenomenal, EMINEM */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; #define ff first #define Shazam \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ss second #define all(c) c.begin(), c.end() #define endl "\n" #define test() \ int t; \ cin >> t; \ while (t--) #define fl(i, a, b) for (int i = a; i < b; i++) #define get(a) fl(i, 0, a.size()) cin >> a[i]; #define pra(a) \ fl(i, 0, a.size()) cout << a[i] << " "; \ cout << endl; #define pr(a, n) \ fl(i, 0, n) cout << a[i] << " "; \ cout << endl; const ll INF = 2e18; const int inf = 2e9; const int mod1 = 1e9 + 7; int main() { Shazam; ll n; cin >> n; ll ans = 0; vector<int> faclist; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int c = 0; while (n % i == 0) { c++; n /= i; } faclist.push_back(c); } } if (n >= 2) ans++; for (int i : faclist) { int c = 0; int s = 0; while (s < i) { c++; s += c; if (s <= i) ans++; } } cout << ans << endl; return 0; }
/* "Won't stop untill I'm Phenomenal" - Phenomenal, EMINEM */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; #define ff first #define Shazam \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ss second #define all(c) c.begin(), c.end() #define endl "\n" #define test() \ int t; \ cin >> t; \ while (t--) #define fl(i, a, b) for (int i = a; i < b; i++) #define get(a) fl(i, 0, a.size()) cin >> a[i]; #define pra(a) \ fl(i, 0, a.size()) cout << a[i] << " "; \ cout << endl; #define pr(a, n) \ fl(i, 0, n) cout << a[i] << " "; \ cout << endl; const ll INF = 2e18; const int inf = 2e9; const int mod1 = 1e9 + 7; int main() { Shazam; ll n; cin >> n; ll ans = 0; vector<int> faclist; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { int c = 0; while (n % i == 0) { c++; n /= i; } faclist.push_back(c); } } if (n >= 2) ans++; for (int i : faclist) { int c = 0; int s = 0; while (s < i) { c++; s += c; if (s <= i) ans++; } } cout << ans << endl; return 0; }
replace
38
39
38
39
TLE
p02660
C++
Time Limit Exceeded
// #pragma GCC target("avx") // CPU 処理並列化 // #pragma GCC optimize("O3") // CPU 処理並列化 // #pragma GCC optimize("unroll-loops") // 条件処理の呼び出しを減らす // #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = // malloc(size);void * stack_extend_origin_memory_;char * // stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long // long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm // volatile("mov %%rsp, %%rbx\nmov %%rax, // %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024)); // #define END_STACK_EXTEND asm volatile("mov %%rax, // %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_); #include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <deque> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const long long mod = 1000000007; const long long inf = mod * mod; const long long d2 = (mod + 1) / 2; const double EPS = 1e-11; const double INF = 1e+10; const double PI = acos(-1.0); const int C_SIZE = 11100000; const int UF_SIZE = 3100000; namespace { long long fact[C_SIZE]; long long finv[C_SIZE]; long long inv[C_SIZE]; inline long long Comb(int a, int b) { if (a < b || b < 0) return 0; return fact[a] * finv[b] % mod * finv[a - b] % mod; } void init_C(int n) { fact[0] = finv[0] = inv[1] = 1; for (int i = 2; i < n; i++) { inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod; } for (int i = 1; i < n; i++) { fact[i] = fact[i - 1] * i % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } long long pw(long long a, long long b) { if (a < 0LL) return 0; if (b < 0LL) return 0; long long ret = 1; while (b) { if (b % 2) ret = ret * a % mod; a = a * a % mod; b /= 2; } return ret; } long long pw_mod(long long a, long long b, long long M) { if (a < 0LL) return 0; if (b < 0LL) return 0; long long ret = 1; while (b) { if (b % 2) ret = ret * a % M; a = a * a % M; b /= 2; } return ret; } int pw_mod_int(int a, int b, int M) { if (a < 0) return 0; if (b < 0) return 0; int ret = 1; while (b) { if (b % 2) ret = (long long)ret * a % M; a = (long long)a * a % M; b /= 2; } return ret; } int ABS(int a) { return max(a, -a); } long long ABS(long long a) { return max(a, -a); } double ABS(double a) { return max(a, -a); } int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; } int UF[UF_SIZE]; void init_UF(int n) { for (int i = 0; i < n; i++) UF[i] = -1; } int FIND(int a) { if (UF[a] < 0) return a; return UF[a] = FIND(UF[a]); } void UNION(int a, int b) { a = FIND(a); b = FIND(b); if (a == b) return; if (UF[a] > UF[b]) swap(a, b); UF[a] += UF[b]; UF[b] = a; } } // namespace // ここから編集しろ int main() { long long a; scanf("%lld", &a); int ret = 0; for (int i = 2; i * i <= a; i++) { if (a % i) continue; int cnt = 0; while (a % i == 0) { a /= i; cnt++; } int now = 1; while (cnt >= now) { cnt -= now; ret++; now++; } } if (a > 1) { ret++; } printf("%d\n", ret); }
// #pragma GCC target("avx") // CPU 処理並列化 // #pragma GCC optimize("O3") // CPU 処理並列化 // #pragma GCC optimize("unroll-loops") // 条件処理の呼び出しを減らす // #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = // malloc(size);void * stack_extend_origin_memory_;char * // stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long // long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm // volatile("mov %%rsp, %%rbx\nmov %%rax, // %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024)); // #define END_STACK_EXTEND asm volatile("mov %%rax, // %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_); #include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <deque> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const long long mod = 1000000007; const long long inf = mod * mod; const long long d2 = (mod + 1) / 2; const double EPS = 1e-11; const double INF = 1e+10; const double PI = acos(-1.0); const int C_SIZE = 11100000; const int UF_SIZE = 3100000; namespace { long long fact[C_SIZE]; long long finv[C_SIZE]; long long inv[C_SIZE]; inline long long Comb(int a, int b) { if (a < b || b < 0) return 0; return fact[a] * finv[b] % mod * finv[a - b] % mod; } void init_C(int n) { fact[0] = finv[0] = inv[1] = 1; for (int i = 2; i < n; i++) { inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod; } for (int i = 1; i < n; i++) { fact[i] = fact[i - 1] * i % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } long long pw(long long a, long long b) { if (a < 0LL) return 0; if (b < 0LL) return 0; long long ret = 1; while (b) { if (b % 2) ret = ret * a % mod; a = a * a % mod; b /= 2; } return ret; } long long pw_mod(long long a, long long b, long long M) { if (a < 0LL) return 0; if (b < 0LL) return 0; long long ret = 1; while (b) { if (b % 2) ret = ret * a % M; a = a * a % M; b /= 2; } return ret; } int pw_mod_int(int a, int b, int M) { if (a < 0) return 0; if (b < 0) return 0; int ret = 1; while (b) { if (b % 2) ret = (long long)ret * a % M; a = (long long)a * a % M; b /= 2; } return ret; } int ABS(int a) { return max(a, -a); } long long ABS(long long a) { return max(a, -a); } double ABS(double a) { return max(a, -a); } int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; } int UF[UF_SIZE]; void init_UF(int n) { for (int i = 0; i < n; i++) UF[i] = -1; } int FIND(int a) { if (UF[a] < 0) return a; return UF[a] = FIND(UF[a]); } void UNION(int a, int b) { a = FIND(a); b = FIND(b); if (a == b) return; if (UF[a] > UF[b]) swap(a, b); UF[a] += UF[b]; UF[b] = a; } } // namespace // ここから編集しろ int main() { long long a; scanf("%lld", &a); int ret = 0; for (int i = 2; (long long)i * i <= a; i++) { if (a % i) continue; int cnt = 0; while (a % i == 0) { a /= i; cnt++; } int now = 1; while (cnt >= now) { cnt -= now; ret++; now++; } } if (a > 1) { ret++; } printf("%d\n", ret); }
replace
132
133
132
133
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; ll n; int main() { cin >> n; if (n == 1) { cout << 0; return 0; } ll cnt = 0; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { ll times = 0; while (n % i == 0) { n /= i; times++; } ll t = 1; while (t <= times) { cnt++; times -= t; t++; } } } if (n != 1) cnt++; cout << cnt; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; ll n; int main() { cin >> n; if (n == 1) { cout << 0; return 0; } ll cnt = 0; if (n % 2 == 0) { ll times = 0; while (n % 2 == 0) { n /= 2; times++; } ll t = 1; while (t <= times) { cnt++; times -= t; t++; } } for (ll i = 3; i * i <= n; i += 2) { if (n % i == 0) { ll times = 0; while (n % i == 0) { n /= i; times++; } ll t = 1; while (t <= times) { cnt++; times -= t; t++; } } } if (n != 1) cnt++; cout << cnt; return 0; }
replace
13
14
13
28
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long n; int cnt = 0; cin >> n; int cnt2 = 0; vector<pair<long, long>> v(0); for (int i = 2; i * i < n; i++) { while (n % i == 0) { cnt++; n = n / i; } if (cnt != 0) v.push_back(make_pair(i, cnt)); cnt = 0; } if (n != 1) v.push_back(make_pair(n, 1)); for (int i = 0; i < v.size(); i++) { for (int j = 0; j < 1000; j++) { if (j * (j + 1) / 2 > v[i].second) { cnt2 += j - 1; break; } } } cout << cnt2 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long n; int cnt = 0; cin >> n; int cnt2 = 0; vector<pair<long, long>> v(0); for (long i = 2; i * i < n; i++) { while (n % i == 0) { cnt++; n = n / i; } if (cnt != 0) v.push_back(make_pair(i, cnt)); cnt = 0; } if (n != 1) v.push_back(make_pair(n, 1)); for (int i = 0; i < v.size(); i++) { for (int j = 0; j < 1000; j++) { if (j * (j + 1) / 2 > v[i].second) { cnt2 += j - 1; break; } } } cout << cnt2 << endl; }
replace
8
9
8
9
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define fi first #define se second #define m_p make_pair #define p_b push_back #define e_b emplace_back #define all(x) (x).begin(), (x).end() #define uniq(x) ((x).erase(unique(all(x)), (x).end())) #define sz(x) ((int)(x).size()) #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #ifdef LOCAL // compile with -DLOCAL #define debug(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl #define debug_vec(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = "; \ rep(i, sz(x)) { cerr << x[i] << " "; } \ cerr << endl #define debug_mat(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = " << endl; \ rep(i, sz(x)) { \ rep(j, sz(x[i])) { cerr << x[i][j] << " "; } \ cerr << endl; \ } \ cerr << endl #else #define debug(x) void(0) #define debug_vec(x) void(0) #define debug_mat(x) void(0) #endif template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; int ans = 0; for (int i = 2; i * i <= N; i++) { if (N % i != 0) continue; int cnt = 0; while (N % i == 0) { N /= i; cnt++; } for (int j = 1; j <= cnt; j++) { ans++; cnt -= j; } } if (N != 1) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define fi first #define se second #define m_p make_pair #define p_b push_back #define e_b emplace_back #define all(x) (x).begin(), (x).end() #define uniq(x) ((x).erase(unique(all(x)), (x).end())) #define sz(x) ((int)(x).size()) #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #ifdef LOCAL // compile with -DLOCAL #define debug(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl #define debug_vec(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = "; \ rep(i, sz(x)) { cerr << x[i] << " "; } \ cerr << endl #define debug_mat(x) \ cerr << "LINE" << __LINE__ << " : " << #x << " = " << endl; \ rep(i, sz(x)) { \ rep(j, sz(x[i])) { cerr << x[i][j] << " "; } \ cerr << endl; \ } \ cerr << endl #else #define debug(x) void(0) #define debug_vec(x) void(0) #define debug_mat(x) void(0) #endif template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; int ans = 0; for (ll i = 2; i * i <= N; i++) { if (N % i != 0) continue; int cnt = 0; while (N % i == 0) { N /= i; cnt++; } for (int j = 1; j <= cnt; j++) { ans++; cnt -= j; } } if (N != 1) ans++; cout << ans << endl; return 0; }
replace
59
60
59
60
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> #define fin freopen("input", "r", stdin); #define fout freopen("output", "w", stdout); #define wt(x) cerr << #x << ": " << x << " "; #define whatis(x) \ { cerr << #x << ": " << x << endl; } #define whatis2(x, y) \ { \ wt(x); \ wt(y); \ cerr << endl; \ } #define whatis3(x, y, z) \ { \ wt(x); \ wt(y); \ wt(z); \ cerr << endl; \ } #define whatis4(x, y, z, a) \ { \ wt(x); \ wt(y); \ wt(z); \ wt(a); \ cerr << endl; \ } using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1.0); const int N = 100000; int power[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; ll cnt = 0; for (ll i = 2; i * i <= n; ++i) { while (n % i == 0) { n /= i; power[i] += 1; } } int ans = 0; if (n > 2) { /* power[n] += 1; */ ans += 1; } for (int i = 0; i < N; ++i) { int val = 1; int cnt = 0; while (power[i]) { cnt += val; val += 1; /* if (i == 2) whatis(cnt); */ if (cnt <= power[i]) { ans += 1; } else { break; } } } /* whatis(power[3]); */ /* whatis(power[2]); */ cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define fin freopen("input", "r", stdin); #define fout freopen("output", "w", stdout); #define wt(x) cerr << #x << ": " << x << " "; #define whatis(x) \ { cerr << #x << ": " << x << endl; } #define whatis2(x, y) \ { \ wt(x); \ wt(y); \ cerr << endl; \ } #define whatis3(x, y, z) \ { \ wt(x); \ wt(y); \ wt(z); \ cerr << endl; \ } #define whatis4(x, y, z, a) \ { \ wt(x); \ wt(y); \ wt(z); \ wt(a); \ cerr << endl; \ } using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1.0); const int N = 1000000; int power[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; ll cnt = 0; for (ll i = 2; i * i <= n; ++i) { while (n % i == 0) { n /= i; power[i] += 1; } } int ans = 0; if (n > 2) { /* power[n] += 1; */ ans += 1; } for (int i = 0; i < N; ++i) { int val = 1; int cnt = 0; while (power[i]) { cnt += val; val += 1; /* if (i == 2) whatis(cnt); */ if (cnt <= power[i]) { ans += 1; } else { break; } } } /* whatis(power[3]); */ /* whatis(power[2]); */ cout << ans << endl; return 0; }
replace
35
36
35
36
0
p02660
C++
Time Limit Exceeded
#include <stdio.h> #define LL long long int p[50], m[50], tot; int main() { LL n; int i, j, ans = 0; scanf("%lld", &n); for (i = 2; i * i <= n; i++) if (n % i == 0) { p[++tot] = i; while (n % i == 0) n /= i, m[tot]++; } if (n > 1) p[++tot] = n, m[tot] = 1; for (i = 1; i <= tot; i++) { j = 1; while (1) { if (m[i] >= j) ans++, m[i] -= j; else break; j++; } } printf("%d\n", ans); return 0; }
#include <stdio.h> #define LL long long int p[50], m[50], tot; int main() { LL n; int i, j, ans = 0; scanf("%lld", &n); for (i = 2; (LL)i * i <= n; i++) if (n % i == 0) { p[++tot] = i; while (n % i == 0) n /= i, m[tot]++; } if (n > 1) p[++tot] = n, m[tot] = 1; for (i = 1; i <= tot; i++) { j = 1; while (1) { if (m[i] >= j) ans++, m[i] -= j; else break; j++; } } printf("%d\n", ans); return 0; }
replace
7
8
7
8
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; int total = 0; // zの合計 int64_t i = 2; while (n > 1) { int count = 1; // 各素因数におけるeのパターン数 for (int j = 1; n % i == 0; j++) { if (j == count * (count + 1) / 2) { total++; count++; } n /= i; } if (i == 2) i++; else i += 2; } cout << total << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; int total = 0; // zの合計 int64_t i = 2; while (n > 1) { if (i > 1000000) { total++; break; } int count = 1; // 各素因数におけるeのパターン数 for (int j = 1; n % i == 0; j++) { if (j == count * (count + 1) / 2) { total++; count++; } n /= i; } if (i == 2) i++; else i += 2; } cout << total << endl; }
insert
9
9
9
14
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <cmath> #include <ctime> #include <map> #include <math.h> #include <typeinfo> #define R(i, n) for (int i = 0; i < n; i++) #define S(a) scanf("%d", &a) #define S2(a, b) scanf("%d%d", &a, &b) #define S3(a, b, c) scanf("%d%d%d", &a, &b, &c) #define SL(a) scanf("%lld", &a) #define SL2(a, b) scanf("%lld%lld", &a, &b) #define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c) #define SA(i, n, a) R(i, n) scanf("%d", &a[i]) #define SAL(i, n, a) R(i, n) scanf("%lld", &a[i]) #define SC(a) scanf("%c", &a) #define P(a) printf("%d", a) #define PL(a) printf("%lld", a) #define PY printf("YES") #define PN printf("NO") #define Py printf("Yes") #define Pn printf("No") using namespace std; using ll = long long; using PR = pair<int, int>; const ll MOD = 1e+9 + 7; const int INF = 1e+9; const double PI = acos(-1); map<ll, int> primeFactor(ll n) { map<ll, int> ret; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } int main() { ll N; SL(N); map<ll, int> m = primeFactor(N); int ans = 0; for (auto x : m) { int e = 1; while (x.second - e >= 0) { ans++; x.second -= e; e++; } } P(ans); }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <cmath> #include <ctime> #include <map> #include <math.h> #include <typeinfo> #define R(i, n) for (int i = 0; i < n; i++) #define S(a) scanf("%d", &a) #define S2(a, b) scanf("%d%d", &a, &b) #define S3(a, b, c) scanf("%d%d%d", &a, &b, &c) #define SL(a) scanf("%lld", &a) #define SL2(a, b) scanf("%lld%lld", &a, &b) #define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c) #define SA(i, n, a) R(i, n) scanf("%d", &a[i]) #define SAL(i, n, a) R(i, n) scanf("%lld", &a[i]) #define SC(a) scanf("%c", &a) #define P(a) printf("%d", a) #define PL(a) printf("%lld", a) #define PY printf("YES") #define PN printf("NO") #define Py printf("Yes") #define Pn printf("No") using namespace std; using ll = long long; using PR = pair<int, int>; const ll MOD = 1e+9 + 7; const int INF = 1e+9; const double PI = acos(-1); map<ll, int> primeFactor(ll n) { map<ll, int> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } int main() { ll N; SL(N); map<ll, int> m = primeFactor(N); int ans = 0; for (auto x : m) { int e = 1; while (x.second - e >= 0) { ans++; x.second -= e; e++; } } P(ans); }
replace
37
38
37
38
TLE
p02660
C++
Time Limit Exceeded
#include <cstdio> int f[50]; long long n; int res = 0; int main() { for (int i = 1; i < 10; i++) { f[i * (i + 1) / 2] = i; } for (int i = 1; i < 50; i++) { if (f[i] < f[i - 1]) { f[i] = f[i - 1]; } } scanf("%lld", &n); for (int i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } res += f[cnt]; } } if (n != 1) { res += f[1]; } printf("%d\n", res); }
#include <cstdio> int f[50]; long long n; int res = 0; int main() { for (int i = 1; i < 10; i++) { f[i * (i + 1) / 2] = i; } for (int i = 1; i < 50; i++) { if (f[i] < f[i - 1]) { f[i] = f[i - 1]; } } scanf("%lld", &n); for (int i = 2; 1ll * i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; } res += f[cnt]; } } if (n != 1) { res += f[1]; } printf("%d\n", res); }
replace
16
17
16
17
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll maxn = 1e5 + 5; const ll maxm = 1e3 + 5; inline void qread() {} template <class T1, class... T2> inline void qread(T1 &IEE, T2 &...ls) { register T1 __ = 0, ___ = 1; register char ch; while (!isdigit(ch = getchar())) ___ = (ch == '-') ? -___ : ___; do { __ = (__ << 1) + (__ << 3) + (ch ^ 48); } while (isdigit(ch = getchar())); __ *= ___; IEE = __; qread(ls...); return; } ll n, ans; ll f[maxn]; int main() { cin >> n; for (int i = 1; i <= 10; i++) { f[i] = i * (i + 1) / 2; } for (int i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } int id = lower_bound(f + 1, f + 11, cnt) - f; if (f[id] > cnt) id--; ans += id; } if (n > 1) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll maxn = 1e5 + 5; const ll maxm = 1e3 + 5; inline void qread() {} template <class T1, class... T2> inline void qread(T1 &IEE, T2 &...ls) { register T1 __ = 0, ___ = 1; register char ch; while (!isdigit(ch = getchar())) ___ = (ch == '-') ? -___ : ___; do { __ = (__ << 1) + (__ << 3) + (ch ^ 48); } while (isdigit(ch = getchar())); __ *= ___; IEE = __; qread(ls...); return; } ll n, ans; ll f[maxn]; int main() { cin >> n; for (int i = 1; i <= 10; i++) { f[i] = i * (i + 1) / 2; } for (ll i = 2; i * i <= n; i++) { int cnt = 0; while (n % i == 0) { cnt++; n /= i; } int id = lower_bound(f + 1, f + 11, cnt) - f; if (f[id] > cnt) id--; ans += id; } if (n > 1) ans++; cout << ans << endl; return 0; }
replace
27
28
27
28
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; vector<ll> factors(ll N) { vector<ll> ret; if (N % 2 == 0) { ret.push_back(2); while (N % 2 == 0) N /= 2; } ll root = sqrt(N); for (ll p = 3; p <= root; p += 2) { if (N % p) continue; ret.push_back(p); while (N % p == 0) N /= p; } if (N > 1) ret.push_back(N); return ret; } int main() { ios_base::sync_with_stdio(false); ll N; cin >> N; ll score = 0; for (ll p : factors(N)) { // divide out increasing powers of p for (ll q = p; N % q == 0; q *= p) { N /= q; score++; } // leftover power of p if (N % p == 0) N /= p; } assert(N == 1); cout << score << endl; }
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; vector<ll> factors(ll N) { vector<ll> ret; if (N % 2 == 0) { ret.push_back(2); while (N % 2 == 0) N /= 2; } ll root = sqrt(N); for (ll p = 3; p <= root; p += 2) { if (N % p) continue; ret.push_back(p); while (N % p == 0) N /= p; } if (N > 1) ret.push_back(N); return ret; } int main() { ios_base::sync_with_stdio(false); ll N; cin >> N; ll score = 0; for (ll p : factors(N)) { // divide out increasing powers of p for (ll q = p; N % q == 0; q *= p) { N /= q; score++; } // leftover powers of p while (N % p == 0) N /= p; } assert(N == 1); cout << score << endl; }
replace
39
41
39
41
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // 小数点以下桁数 // fixed << setprecision(i) int64_t gcd(int64_t a, int64_t b) { return (a % b == 0 ? b : gcd(b, a % b)); } int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; } int factorial(int a) { int b = 1; while (a) { b *= a--; } return b; } // 13以下対応 bool is_prime(int64_t a) { if (a <= 1) return false; for (int64_t i = 2; (int64_t)i * i <= a; i++) { if (a % i == 0) return false; } return true; } int get_adp(double x, int n) { return (int)round((x - (int)x) * pow(10, n)) % 10; } // 小数点以下の指定桁の値を取得 int64_t sigma(int64_t s, int64_t n) { return n * (2 * s + n - 1) / 2; } // 順列の全列挙 // vector<int> v(N); // iota(v.begin(), v.end(), 1); // v に 1, 2, ... N を設定 // do { // for(auto x : v) cout << x << " "; cout << "\n"; // v の要素を表示 // } while( next_permutation(v.begin(), v.end()) ); // bit全探索 // for (int tmp = 0; tmp < (1 << ビット数); tmp++) { // bitset<ビット数> s(tmp); // // (ビット列sに対する処理) // } int main() { int64_t n, ans = 0, temp; cin >> n; for (int i = 2; i * i <= n; i++) { if (n % i != 0) continue; temp = i; while (n % temp == 0) { n /= temp; ans++; temp *= i; } while (n % i == 0) n /= i; } if (n != 1) ans++; cout << ans << endl; } // 6534603030013
#include <bits/stdc++.h> using namespace std; // 小数点以下桁数 // fixed << setprecision(i) int64_t gcd(int64_t a, int64_t b) { return (a % b == 0 ? b : gcd(b, a % b)); } int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; } int factorial(int a) { int b = 1; while (a) { b *= a--; } return b; } // 13以下対応 bool is_prime(int64_t a) { if (a <= 1) return false; for (int64_t i = 2; (int64_t)i * i <= a; i++) { if (a % i == 0) return false; } return true; } int get_adp(double x, int n) { return (int)round((x - (int)x) * pow(10, n)) % 10; } // 小数点以下の指定桁の値を取得 int64_t sigma(int64_t s, int64_t n) { return n * (2 * s + n - 1) / 2; } // 順列の全列挙 // vector<int> v(N); // iota(v.begin(), v.end(), 1); // v に 1, 2, ... N を設定 // do { // for(auto x : v) cout << x << " "; cout << "\n"; // v の要素を表示 // } while( next_permutation(v.begin(), v.end()) ); // bit全探索 // for (int tmp = 0; tmp < (1 << ビット数); tmp++) { // bitset<ビット数> s(tmp); // // (ビット列sに対する処理) // } int main() { int64_t n, ans = 0, temp; cin >> n; for (int64_t i = 2; i * i <= n; i++) { if (n % i != 0) continue; temp = i; while (n % temp == 0) { n /= temp; ans++; temp *= i; } while (n % i == 0) n /= i; } if (n != 1) ans++; cout << ans << endl; } // 6534603030013
replace
46
47
46
47
TLE
p02660
C++
Time Limit Exceeded
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) #define inf 1e9 + 7 using namespace std; typedef long long ll; const double pi = acos(-1); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; map<int, int> mp; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { mp[i]++; n /= i; i--; } } if (n != 1) mp[n]++; int ans = 0; for (auto itr = mp.begin(); itr != mp.end(); itr++) { for (int i = 1; itr->second >= i; i++) { ans++; itr->second -= i; } } cout << ans << endl; }
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstdlib> #include <map> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) #define inf 1e9 + 7 using namespace std; typedef long long ll; const double pi = acos(-1); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; map<ll, ll> mp; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { mp[i]++; n /= i; i--; } } if (n != 1) mp[n]++; int ans = 0; for (auto itr = mp.begin(); itr != mp.end(); itr++) { for (int i = 1; itr->second >= i; i++) { ans++; itr->second -= i; } } cout << ans << endl; }
replace
19
21
19
21
TLE
p02660
C++
Time Limit Exceeded
#include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; int main() { ll n; cin >> n; int ans = 0; for (int i = 2; i * i <= n; i++) { if (n % i != 0) continue; ll cnt = 0; while (n % i == 0) { n /= i; cnt++; } for (ll j = 1;; j++) { if (cnt >= j) { cnt -= j; ans++; } else break; } } if (n != 1) ans++; cout << ans << endl; }
#include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; int main() { ll n; cin >> n; ll ans = 0; for (ll i = 2; i * i <= n; i++) { if (n % i != 0) continue; ll cnt = 0; while (n % i == 0) { n /= i; cnt++; } for (ll j = 1;; j++) { if (cnt >= j) { cnt -= j; ans++; } else break; } } if (n != 1) ans++; cout << ans << endl; }
replace
9
11
9
11
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; // 最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; // 出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(20) << x << endl #define printc(x) cout << setw(2) << setfill('0') << x << endl; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(), (x).end() // for #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define rep(i, a, b) for (int i = (a); i < (b); i++) // 最大公約数 unsigned gcd(unsigned a, unsigned b) { if (a < b) return gcd(b, a); unsigned r; while ((r = a % b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b) { return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } // int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; // UnionFind struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x) { return Size[root(x)]; } }; // modint構造体 struct Mint { int val; Mint inv() const { int tmp, a = val, b = mod, x = 1, y = 0; while (b) tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y); return Mint(x); } public: Mint() : val(0) {} Mint(ll x) { if ((val = x % mod) < 0) val += mod; } Mint pow(ll t) { Mint res = 1, b = *this; while (t) { if (t & 1) res *= b; b *= b; t >>= 1; } return res; } Mint &operator+=(const Mint &x) { if ((val += x.val) >= mod) val -= mod; return *this; } Mint &operator-=(const Mint &x) { if ((val += mod - x.val) >= mod) val -= mod; return *this; } Mint &operator*=(const Mint &x) { val = (ll)val * x.val % mod; return *this; } Mint &operator/=(const Mint &x) { return *this *= x.inv(); } bool operator==(const Mint &x) const { return val == x.val; } bool operator!=(const Mint &x) const { return val != x.val; } bool operator<(const Mint &x) const { return val < x.val; } bool operator<=(const Mint &x) const { return val <= x.val; } bool operator>(const Mint &x) const { return val > x.val; } bool operator>=(const Mint &x) const { return val >= x.val; } Mint operator+(const Mint &x) const { return Mint(*this) += x; } Mint operator-(const Mint &x) const { return Mint(*this) -= x; } Mint operator*(const Mint &x) const { return Mint(*this) *= x; } Mint operator/(const Mint &x) const { return Mint(*this) /= x; } }; struct factorial { vector<Mint> Fact, Finv; public: // factorial fact(10000010); // fact.nCr(a, b) // 「fact」の部分は自由に名前変更可能 factorial(int maxx) { Fact.resize(maxx + 1), Finv.resize(maxx + 1); Fact[0] = Mint(1); rep(i, 0, maxx) Fact[i + 1] = Fact[i] * (i + 1); Finv[maxx] = Mint(1) / Fact[maxx]; rrep(i, maxx, 0) Finv[i - 1] = Finv[i] * i; } Mint fact(int n, bool inv = 0) { if (inv) return Finv[n]; else return Fact[n]; } Mint nPr(int n, int r) { if (n < 0 || n < r || r < 0) return Mint(0); else return Fact[n] * Finv[n - r]; } Mint nCr(int n, int r) { if (n < 0 || n < r || r < 0) return Mint(0); else return Fact[n] * Finv[r] * Finv[n - r]; } }; // 1 * 2 * 3 .... * n (mod) ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } // kが角度だった場合:cos(k * (PI / 180)); const double PI = acos(-1); int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } // ll ans = 0; ll nn = n; set<ll> v; for (ll i = 2; i * i <= n; i++) { ll tmp = i; if (v.count(i)) continue; bool flag = true; for (ll j = 2; j * j <= tmp; j++) { if (tmp % j == 0) { flag = false; break; } } while (nn % tmp == 0 && flag) { // ans++; v.insert(tmp); nn /= tmp; tmp *= i; if (nn == 1) break; } while (nn / i == 0 && flag) { nn /= i; } } if (v.size() == 0) { cout << 1 << endl; return 0; } ll ans = v.size(); if (nn != 1) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; // 最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; // 出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(20) << x << endl #define printc(x) cout << setw(2) << setfill('0') << x << endl; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(), (x).end() // for #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rrep(i, a, b) for (int i = (a); i > (b); i--) #define rep(i, a, b) for (int i = (a); i < (b); i++) // 最大公約数 unsigned gcd(unsigned a, unsigned b) { if (a < b) return gcd(b, a); unsigned r; while ((r = a % b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b) { return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } // int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; // UnionFind struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x) { return Size[root(x)]; } }; // modint構造体 struct Mint { int val; Mint inv() const { int tmp, a = val, b = mod, x = 1, y = 0; while (b) tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y); return Mint(x); } public: Mint() : val(0) {} Mint(ll x) { if ((val = x % mod) < 0) val += mod; } Mint pow(ll t) { Mint res = 1, b = *this; while (t) { if (t & 1) res *= b; b *= b; t >>= 1; } return res; } Mint &operator+=(const Mint &x) { if ((val += x.val) >= mod) val -= mod; return *this; } Mint &operator-=(const Mint &x) { if ((val += mod - x.val) >= mod) val -= mod; return *this; } Mint &operator*=(const Mint &x) { val = (ll)val * x.val % mod; return *this; } Mint &operator/=(const Mint &x) { return *this *= x.inv(); } bool operator==(const Mint &x) const { return val == x.val; } bool operator!=(const Mint &x) const { return val != x.val; } bool operator<(const Mint &x) const { return val < x.val; } bool operator<=(const Mint &x) const { return val <= x.val; } bool operator>(const Mint &x) const { return val > x.val; } bool operator>=(const Mint &x) const { return val >= x.val; } Mint operator+(const Mint &x) const { return Mint(*this) += x; } Mint operator-(const Mint &x) const { return Mint(*this) -= x; } Mint operator*(const Mint &x) const { return Mint(*this) *= x; } Mint operator/(const Mint &x) const { return Mint(*this) /= x; } }; struct factorial { vector<Mint> Fact, Finv; public: // factorial fact(10000010); // fact.nCr(a, b) // 「fact」の部分は自由に名前変更可能 factorial(int maxx) { Fact.resize(maxx + 1), Finv.resize(maxx + 1); Fact[0] = Mint(1); rep(i, 0, maxx) Fact[i + 1] = Fact[i] * (i + 1); Finv[maxx] = Mint(1) / Fact[maxx]; rrep(i, maxx, 0) Finv[i - 1] = Finv[i] * i; } Mint fact(int n, bool inv = 0) { if (inv) return Finv[n]; else return Fact[n]; } Mint nPr(int n, int r) { if (n < 0 || n < r || r < 0) return Mint(0); else return Fact[n] * Finv[n - r]; } Mint nCr(int n, int r) { if (n < 0 || n < r || r < 0) return Mint(0); else return Fact[n] * Finv[r] * Finv[n - r]; } }; // 1 * 2 * 3 .... * n (mod) ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } // kが角度だった場合:cos(k * (PI / 180)); const double PI = acos(-1); int main() { ll n; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } // ll ans = 0; ll nn = n; set<ll> v; for (ll i = 2; i * i <= n; i++) { ll tmp = i; if (v.count(i)) continue; bool flag = true; for (ll j = 2; j * j <= tmp; j++) { if (tmp % j == 0) { flag = false; break; } } while (nn % tmp == 0 && flag) { // ans++; v.insert(tmp); nn /= tmp; tmp *= i; if (nn == 1) break; } while (nn % i == 0 && flag) { nn /= i; } } if (v.size() == 0) { cout << 1 << endl; return 0; } ll ans = v.size(); if (nn != 1) ans++; cout << ans << endl; return 0; }
replace
275
276
275
276
TLE
p02660
C++
Time Limit Exceeded
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; #define all(x) begin(x), end(x) #define rep(i, n) for (int i = 0; i < n; i++) int Prime_factorize(ll n) { int cnt = 0; for (int i = 2; i * i <= n; i++) { int th = 1; int now = 0; while (n % i == 0) { now++; if (th == now) { cnt++; now = 0; th++; } n /= i; } if (i != 2) i++; } if (n != 1) cnt++; return cnt; } int main() { ll n; cin >> n; int cnt = Prime_factorize(n); cout << cnt << endl; return 0; }
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long ll; #define all(x) begin(x), end(x) #define rep(i, n) for (int i = 0; i < n; i++) int Prime_factorize(ll n) { int cnt = 0; for (ll i = 2; i * i <= n; i++) { int th = 1; int now = 0; while (n % i == 0) { now++; if (th == now) { cnt++; now = 0; th++; } n /= i; } if (i != 2) i++; } if (n != 1) cnt++; return cnt; } int main() { ll n; cin >> n; int cnt = Prime_factorize(n); cout << cnt << endl; return 0; }
replace
25
26
25
26
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 1001001001; vector<pair<int64_t, int64_t>> func(int64_t x) { vector<pair<int64_t, int64_t>> p; for (int i = 2; i * i <= x; i++) { int cnt = 0; if (x % i == 0) { while (x % i == 0) { cnt++; x /= i; } p.push_back(make_pair(i, cnt)); } } if (x != 1) { p.push_back(make_pair(x, 1)); } return p; } int main() { int64_t N; cin >> N; auto k = func(N); int ans = 0; for (auto a : k) { int t = a.second; int tmp = 1, count = 0; while (t >= tmp) { t -= tmp; tmp++; count++; } ans += count; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 1001001001; vector<pair<int64_t, int64_t>> func(int64_t x) { vector<pair<int64_t, int64_t>> p; for (int64_t i = 2; i * i <= x; i++) { int cnt = 0; if (x % i == 0) { while (x % i == 0) { cnt++; x /= i; } p.push_back(make_pair(i, cnt)); } } if (x != 1) { p.push_back(make_pair(x, 1)); } return p; } int main() { int64_t N; cin >> N; auto k = func(N); int ans = 0; for (auto a : k) { int t = a.second; int tmp = 1, count = 0; while (t >= tmp) { t -= tmp; tmp++; count++; } ans += count; } cout << ans << endl; return 0; }
replace
20
21
20
21
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, b) for (int i = a; i < (b); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll N; cin >> N; int ans = 0; FOR(i, 2, 1000000000) { int cur = 0; while (N % i == 0) { cur++; N /= i; } FOR(j, 1, 10000) { if (cur < j) break; ans++; cur -= j; } } if (N > 1) ans++; cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, b) for (int i = a; i < (b); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll N; cin >> N; int ans = 0; FOR(i, 2, 100000000) { int cur = 0; while (N % i == 0) { cur++; N /= i; } FOR(j, 1, 10000) { if (cur < j) break; ans++; cur -= j; } } if (N > 1) ans++; cout << ans << "\n"; return 0; }
replace
11
12
11
12
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) const int INF = 1001001001; const ll BIG = 1000000007; const double PI = 3.141592653589793; int main() { ll n; cin >> n; map<int, int> primes; for (int p = 2; p * p <= n; p++) { int k = 0; while (n % p == 0) { n /= p; k++; } if (k > 0) { primes[p] = k; } } if (n > 1) { primes[n] = 1; } /* for(auto& prime : primes){ cout << prime.first << " " << prime.second << endl; } */ int ans = 0; for (auto prime : primes) { int i = 1; while (1) { if (((i + 2) * (i + 1)) > 2 * prime.second) { break; } i++; } // cout << i << endl; ans += i; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) const int INF = 1001001001; const ll BIG = 1000000007; const double PI = 3.141592653589793; int main() { ll n; cin >> n; map<ll, ll> primes; for (ll p = 2; p * p <= n; p++) { int k = 0; while (n % p == 0) { n /= p; k++; } if (k > 0) { primes[p] = k; } } if (n > 1) { primes[n] = 1; } /* for(auto& prime : primes){ cout << prime.first << " " << prime.second << endl; } */ int ans = 0; for (auto prime : primes) { int i = 1; while (1) { if (((i + 2) * (i + 1)) > 2 * prime.second) { break; } i++; } // cout << i << endl; ans += i; } cout << ans << endl; return 0; }
replace
15
17
15
17
TLE
p02660
C++
Time Limit Exceeded
#include <cctype> #include <cmath> #include <cstdarg> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <algorithm> #include <queue> #include <stack> #include <tuple> #include <vector> using namespace std; int main(int argc, char const *argv[]) { long long n; cin >> n; long long p = 2; long long ans = 0; long long count = 1; long long now = 0; while (n > 1) { if (n % p == 0) { n /= p; now++; if (count == now) { ans++; now = 0; count++; } } else { if (p == 2) { p = 3; } else { p += 2; } count = 1; now = 0; } } cout << ans << endl; return 0; }
#include <cctype> #include <cmath> #include <cstdarg> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <algorithm> #include <queue> #include <stack> #include <tuple> #include <vector> using namespace std; int main(int argc, char const *argv[]) { long long n; cin >> n; long long p = 2; long long ans = 0; long long count = 1; long long now = 0; while (n > 1) { if (n % p == 0) { n /= p; now++; if (count == now) { ans++; now = 0; count++; } } else { if (p == 2) { p = 3; } else { p += 2; } if (p * p > n) { ans++; break; } count = 1; now = 0; } } cout << ans << endl; return 0; }
insert
38
38
38
42
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; #define fs first #define re resize #define sc second #define pb push_back #define eb emplace_back #define MP make_pair #define all(x) x.begin(), x.end() #define mod 1000000007 #define FOR(i, a, b) for (int i = a; i <= b; i++) #define REP(i, n) FOR(i, 0, n - 1) #define ins insert #define mod 1000000007 #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << std::endl; // use cerr if u want to display at the bottom } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define endl "\n" void fastIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } ll modexpo(ll a, ll b) { if (a == 0) return 0; if (a == 1 or b == 0) return 1; if (b == 1) return a; if (b & 1) return (a % mod * modexpo(a, b - 1) % mod) % mod; return modexpo(a % mod * a % mod, b / 2) % mod; } void printv(vll v) { for (auto &x : v) { cout << x << " "; } cout << endl; } string to_string1(ll x) { stringstream ss; ss << x; return ss.str(); } ll to_integer(string s) { stringstream ss(s); ll x; ss >> x; return x; } #define tp9 1000000000 const ll N = 1e12 + 5; ld pi = 3.1415926535; void printYes() { cout << "Yes\n"; } void printNo() { cout << "No\n"; } ll t, n, p; string s; ll solve(ll n) { ll ans = 0; map<ll, ll> mp; while (n % 2 == 0) { mp[2]++; n >>= 1; } for (ll i = 3; i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n > 2) { mp[n]++; } for (auto p : mp) { ll j = p.sc, i = 1; while ((i * (i + 1) / 2) <= j) { i++; } ans += i - 1; } return ans; } int main() { ll n; while (cin >> n) cout << solve(n) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; #define fs first #define re resize #define sc second #define pb push_back #define eb emplace_back #define MP make_pair #define all(x) x.begin(), x.end() #define mod 1000000007 #define FOR(i, a, b) for (int i = a; i <= b; i++) #define REP(i, n) FOR(i, 0, n - 1) #define ins insert #define mod 1000000007 #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << std::endl; // use cerr if u want to display at the bottom } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define endl "\n" void fastIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } ll modexpo(ll a, ll b) { if (a == 0) return 0; if (a == 1 or b == 0) return 1; if (b == 1) return a; if (b & 1) return (a % mod * modexpo(a, b - 1) % mod) % mod; return modexpo(a % mod * a % mod, b / 2) % mod; } void printv(vll v) { for (auto &x : v) { cout << x << " "; } cout << endl; } string to_string1(ll x) { stringstream ss; ss << x; return ss.str(); } ll to_integer(string s) { stringstream ss(s); ll x; ss >> x; return x; } #define tp9 1000000000 const ll N = 1e12 + 5; ld pi = 3.1415926535; void printYes() { cout << "Yes\n"; } void printNo() { cout << "No\n"; } ll t, n, p; string s; ll solve(ll n) { ll ans = 0; map<ll, ll> mp; while (n % 2 == 0) { mp[2]++; n >>= 1; } for (ll i = 3; i * i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n > 2) { mp[n]++; } for (auto p : mp) { ll j = p.sc, i = 1; while ((i * (i + 1) / 2) <= j) { i++; } ans += i - 1; } return ans; } int main() { ll n; while (cin >> n) cout << solve(n) << endl; return 0; }
replace
88
89
88
89
TLE
p02660
C++
Time Limit Exceeded
// from : https://atcoder.jp/contests/abc169/submissions/13867215 #define __mode_debug__ /* ξ ll _ll_ / ∞ \ │* A *│ │* C *│ │* 祈 *│ │* 願 *│ │* *│  ̄ ̄ ̄ ̄ ̄ */ // C++14 (GCC 5.4.1) #include <bits/stdc++.h> using namespace std; #ifdef __mode_debug__ #define DBG #else #define DBG if (false) #endif #define LLINF (1LL << 60) using ll = long long; #define mod 1000000007 #define whole(a) (a).begin(), (a).end() #define rwhole(a) (a).rbegin(), (a).rend() #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define rrepd(i, a, b) for (ll i = (a); i >= (b); i--) #define each(itr, ds) for (auto itr = (ds).begin(); itr != (ds).end(); itr++) template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } // DUMP // ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , // priority_queue<T> , pair<T,U> , map<T,U> template <class T> ostream &operator<<(ostream &os, vector<T> &vec) { os << "{ "; rep(i, vec.size()) os << ((i == 0) ? "" : ", ") << i << ":" << vec[i]; os << " }"; return os; } template <class T> ostream &operator<<(ostream &os, vector<vector<T>> &vec) { os << "{" << endl; rep(i, vec.size()) os << "\t " << i << ":" << vec[i] << ((i == vec.size() - 1) ? "" : ",") << endl; os << "\t }"; return os; } template <class T> ostream &operator<<(ostream &os, set<T> &p) { os << "{ "; each(itr, p) os << ((itr == p.begin()) ? "" : ", ") << *itr; os << " }"; return os; } template <class T> ostream &operator<<(ostream &os, queue<T> &p) { queue<T> q(p); os << "[< " << (q.empty() ? " <]" : ""); while (!q.empty()) { os << q.front(); q.pop(); os << (q.empty() ? " <]" : ", "); } return os; } template <class T> ostream &operator<<(ostream &os, priority_queue<T> &p) { priority_queue<T> q(p); os << "[< " << (q.empty() ? " <]" : ""); while (!q.empty()) { os << q.top(); q.pop(); os << (q.empty() ? " <]" : ", "); } return os; } template <class T, class U> ostream &operator<<(ostream &os, pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <class T, class U> ostream &operator<<(ostream &os, map<T, U> &p) { os << "{ "; each(itr, p) os << ((itr == p.begin()) ? "" : ", ") << itr->first << ":" << itr->second; os << " }"; return os; } void dump_f(string &nm, char t) { cerr << endl; } template <class T, class... Ts> void dump_f(string &nm, char t, T &&x, Ts &&...ts) { int l = nm.find_first_of(','); string name(nm, 0, l), nx(nm, l + 1, -1); if (t == '\n') cerr << " " << name << "\t: " << x << t; else cerr << name << ": " << x << "," << t; dump_f(nx, t, forward<Ts>(ts)...); } template <class... Ts> void dump_m(int &&ln, string &&nm, char t, Ts &&...ts) { cerr << "[ln: " << ln << "]" << t; dump_f(nm, t, forward<Ts>(ts)...); } #define dump(...) DBG dump_m(__LINE__, #__VA_ARGS__, '\n', __VA_ARGS__) #define dl(...) DBG dump_m(__LINE__, #__VA_ARGS__, '\t', __VA_ARGS__) #define lower_bound_idx(V, c) distance(V.begin(), lower_bound(whole(V), c)) bool issosu(ll n) { bool is = true; if (n == 1) return false; if (n == 2) return true; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { is = false; break; } } return is; } int main() { ios::sync_with_stdio(false); // printf<=>cout cin.tie(nullptr); // cin<=>cout ll N; cin >> N; //----------------------------------- ll ans = 0; for (ll i = 2; i * i <= N; i++) { ll u = 0; while (N % i == 0) { N /= i; u++; } for (ll t = 1; u >= 0; t++) { u -= t; if (u >= 0) ans++; } } if (issosu(N)) ans++; cout << ans << '\n'; return (0); }
// from : https://atcoder.jp/contests/abc169/submissions/13867215 #define __mode_debug__ /* ξ ll _ll_ / ∞ \ │* A *│ │* C *│ │* 祈 *│ │* 願 *│ │* *│  ̄ ̄ ̄ ̄ ̄ */ // C++14 (GCC 5.4.1) #include <bits/stdc++.h> using namespace std; #ifdef __mode_debug__ #define DBG #else #define DBG if (false) #endif #define LLINF (1LL << 60) using ll = long long; #define mod 1000000007 #define whole(a) (a).begin(), (a).end() #define rwhole(a) (a).rbegin(), (a).rend() #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define rrepd(i, a, b) for (ll i = (a); i >= (b); i--) #define each(itr, ds) for (auto itr = (ds).begin(); itr != (ds).end(); itr++) template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } // DUMP // ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , // priority_queue<T> , pair<T,U> , map<T,U> template <class T> ostream &operator<<(ostream &os, vector<T> &vec) { os << "{ "; rep(i, vec.size()) os << ((i == 0) ? "" : ", ") << i << ":" << vec[i]; os << " }"; return os; } template <class T> ostream &operator<<(ostream &os, vector<vector<T>> &vec) { os << "{" << endl; rep(i, vec.size()) os << "\t " << i << ":" << vec[i] << ((i == vec.size() - 1) ? "" : ",") << endl; os << "\t }"; return os; } template <class T> ostream &operator<<(ostream &os, set<T> &p) { os << "{ "; each(itr, p) os << ((itr == p.begin()) ? "" : ", ") << *itr; os << " }"; return os; } template <class T> ostream &operator<<(ostream &os, queue<T> &p) { queue<T> q(p); os << "[< " << (q.empty() ? " <]" : ""); while (!q.empty()) { os << q.front(); q.pop(); os << (q.empty() ? " <]" : ", "); } return os; } template <class T> ostream &operator<<(ostream &os, priority_queue<T> &p) { priority_queue<T> q(p); os << "[< " << (q.empty() ? " <]" : ""); while (!q.empty()) { os << q.top(); q.pop(); os << (q.empty() ? " <]" : ", "); } return os; } template <class T, class U> ostream &operator<<(ostream &os, pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <class T, class U> ostream &operator<<(ostream &os, map<T, U> &p) { os << "{ "; each(itr, p) os << ((itr == p.begin()) ? "" : ", ") << itr->first << ":" << itr->second; os << " }"; return os; } void dump_f(string &nm, char t) { cerr << endl; } template <class T, class... Ts> void dump_f(string &nm, char t, T &&x, Ts &&...ts) { int l = nm.find_first_of(','); string name(nm, 0, l), nx(nm, l + 1, -1); if (t == '\n') cerr << " " << name << "\t: " << x << t; else cerr << name << ": " << x << "," << t; dump_f(nx, t, forward<Ts>(ts)...); } template <class... Ts> void dump_m(int &&ln, string &&nm, char t, Ts &&...ts) { cerr << "[ln: " << ln << "]" << t; dump_f(nm, t, forward<Ts>(ts)...); } #define dump(...) DBG dump_m(__LINE__, #__VA_ARGS__, '\n', __VA_ARGS__) #define dl(...) DBG dump_m(__LINE__, #__VA_ARGS__, '\t', __VA_ARGS__) #define lower_bound_idx(V, c) distance(V.begin(), lower_bound(whole(V), c)) bool issosu(ll n) { bool is = true; if (n == 1) return false; if (n == 2) return true; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { is = false; break; } } return is; } int main() { ios::sync_with_stdio(false); // printf<=>cout cin.tie(nullptr); // cin<=>cout ll N; cin >> N; //----------------------------------- ll ans = 0; for (ll i = 2; i * i <= N; i++) { ll u = 0; while (N % i == 0) { N /= i; u++; } for (ll t = 1; u >= 0; t++) { u -= t; if (u >= 0) ans++; } } if (issosu(N)) ans++; cout << ans << '\n'; return (0); }
replace
133
134
133
134
TLE
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long using namespace std; ll p; ll calc(ll n) { ll res = (1 + n) * n / 2; return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed; #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); #endif ll ans = 0; cin >> p; vector<pair<int, int>> pref; for (int i = 2; i * i <= p; ++i) { if (p % i == 0) { int cnt = 0; while (p % i == 0) { p /= i; ++cnt; } pref.push_back(make_pair(i, cnt)); ll l = 1, r = 10, res; while (l <= r) { ll mid = (l + r) >> 1; if (calc(mid) <= cnt) { res = mid; l = mid + 1; } else { r = mid - 1; } } ans += res; } } if (p > 1) { pref.push_back(make_pair(p, 1)); ++ans; } cout << ans << '\n'; #ifdef LOCAL_DEFINE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; ll p; ll calc(ll n) { ll res = (1 + n) * n / 2; return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed; #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); #endif ll ans = 0; cin >> p; vector<pair<int, int>> pref; for (ll i = 2; i * i <= p; ++i) { if (p % i == 0) { int cnt = 0; while (p % i == 0) { p /= i; ++cnt; } pref.push_back(make_pair(i, cnt)); ll l = 1, r = 10, res; while (l <= r) { ll mid = (l + r) >> 1; if (calc(mid) <= cnt) { res = mid; l = mid + 1; } else { r = mid - 1; } } ans += res; } } if (p > 1) { pref.push_back(make_pair(p, 1)); ++ans; } cout << ans << '\n'; #ifdef LOCAL_DEFINE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
replace
25
26
25
26
TLE
p02660
C++
Runtime Error
#include <bits/stdc++.h> #define LL long long using namespace std; LL ksc(LL a, LL n, LL mod) { LL ret = 0; for (; n; n >>= 1) { if (n & 1) { ret += a; if (ret >= mod) ret -= mod; } a <<= 1; if (a >= mod) a -= mod; } return ret; } LL ksm(LL a, LL n, LL mod) { LL ret = 1; for (; n; n >>= 1) { if (n & 1) ret = ksc(ret, a, mod); a = ksc(a, a, mod); } return ret; } int millerRabin(LL n) { if (n < 2 || (n != 2 && !(n & 1))) return 0; LL d = n - 1; for (; !(d & 1); d >>= 1) ; for (int i = 0; i < 20; ++i) { LL a = rand() % (n - 1) + 1; LL t = d, m = ksm(a, d, n); for (; t != n - 1 && m != 1 && m != n - 1; m = ksc(m, m, n), t <<= 1) ; if (m != n - 1 && !(t & 1)) return 0; } return 1; } LL cnt, fact[100]; LL gcd(LL a, LL b) { return !b ? a : gcd(b, a % b); } LL pollardRho(LL n, int a) { LL x = rand() % n, y = x, d = 1, k = 0, i = 1; while (d == 1) { ++k; x = ksc(x, x, n) + a; if (x >= n) x -= n; d = gcd(x > y ? x - y : y - x, n); if (k == i) { y = x; i <<= 1; } } if (d == n) return pollardRho(n, a + 1); return d; } void findfac(LL n) { if (millerRabin(n)) { fact[++cnt] = n; return; } LL p = pollardRho(n, rand() % (n - 1) + 1); findfac(p); findfac(n / p); } LL l, ans; LL n; LL a[100], b[100]; int main() { scanf("%lld", &n); findfac(n); sort(fact + 1, fact + 1 + cnt); for (int i = 1; i <= cnt; ++i) { if (fact[i] != fact[i - 1]) { ++l; a[l] = fact[i]; ++b[l]; } else ++b[l]; } for (int i = 1; i <= l; ++i) { for (int j = 1; j <= 100; ++j) if (b[i] >= j) { ++ans; b[i] -= j; } else break; } printf("%lld", ans); }
#include <bits/stdc++.h> #define LL long long using namespace std; LL ksc(LL a, LL n, LL mod) { LL ret = 0; for (; n; n >>= 1) { if (n & 1) { ret += a; if (ret >= mod) ret -= mod; } a <<= 1; if (a >= mod) a -= mod; } return ret; } LL ksm(LL a, LL n, LL mod) { LL ret = 1; for (; n; n >>= 1) { if (n & 1) ret = ksc(ret, a, mod); a = ksc(a, a, mod); } return ret; } int millerRabin(LL n) { if (n < 2 || (n != 2 && !(n & 1))) return 0; LL d = n - 1; for (; !(d & 1); d >>= 1) ; for (int i = 0; i < 20; ++i) { LL a = rand() % (n - 1) + 1; LL t = d, m = ksm(a, d, n); for (; t != n - 1 && m != 1 && m != n - 1; m = ksc(m, m, n), t <<= 1) ; if (m != n - 1 && !(t & 1)) return 0; } return 1; } LL cnt, fact[100]; LL gcd(LL a, LL b) { return !b ? a : gcd(b, a % b); } LL pollardRho(LL n, int a) { LL x = rand() % n, y = x, d = 1, k = 0, i = 1; while (d == 1) { ++k; x = ksc(x, x, n) + a; if (x >= n) x -= n; d = gcd(x > y ? x - y : y - x, n); if (k == i) { y = x; i <<= 1; } } if (d == n) return pollardRho(n, a + 1); return d; } void findfac(LL n) { if (millerRabin(n)) { fact[++cnt] = n; return; } LL p = pollardRho(n, rand() % (n - 1) + 1); findfac(p); findfac(n / p); } LL l, ans; LL n; LL a[100], b[100]; int main() { scanf("%lld", &n); if (n == 1) { printf("0"); return 0; } findfac(n); sort(fact + 1, fact + 1 + cnt); for (int i = 1; i <= cnt; ++i) { if (fact[i] != fact[i - 1]) { ++l; a[l] = fact[i]; ++b[l]; } else ++b[l]; } for (int i = 1; i <= l; ++i) { for (int j = 1; j <= 100; ++j) if (b[i] >= j) { ++ans; b[i] -= j; } else break; } printf("%lld", ans); }
insert
75
75
75
79
0
p02660
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long n; cin >> n; map<int, int> p; while (n % 2 == 0) { n /= 2; p[2] += 1; } int i = 3; while (n != 1 || n >= i) { if (n % i == 0) { p[i]++; n /= i; } else { i += 2; } } int ans = 0; for (auto i : p) { int k = 1; while (i.second >= k) { ans++; i.second -= k; k++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long n; cin >> n; map<int, int> p; while (n % 2 == 0) { n /= 2; p[2] += 1; } int i = 3; while (n != 1 || n >= i) { if (pow(n, 0.5) < i) { p[n]++; break; } if (n % i == 0) { p[i]++; n /= i; } else { i += 2; } } int ans = 0; for (auto i : p) { int k = 1; while (i.second >= k) { ans++; i.second -= k; k++; } } cout << ans << endl; return 0; }
insert
14
14
14
18
TLE