/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 31ms 9.102 MiB
#2 Accepted 33ms 9.145 MiB
#3 Accepted 32ms 9.023 MiB
#4 Accepted 56ms 9.152 MiB
#5 Accepted 72ms 10.836 MiB
#6 Accepted 39ms 9.371 MiB
#7 Accepted 56ms 9.566 MiB
#8 Accepted 38ms 9.145 MiB
#9 Accepted 62ms 9.664 MiB
#10 Accepted 37ms 9.012 MiB
#11 Accepted 77ms 9.152 MiB

Code

/*
 *   Copyright (c) 2024 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

bool notprime[1000006];
vector<ll>lowestprime(1000006);
void seivelp()
{
    lowestprime[1]=1;
    for(int i=2;i<=1000000;i++)
    {
        if(notprime[i]) continue;
        lowestprime[i]=i;
        for(int j=i+i;j<=1000000;j+=i)
        {
            if(lowestprime[j]==0) lowestprime[j]=i;
            notprime[j]=true;
        }
    }
}

void primefactor(ll num,map<ll,ll>&m)
{
    while(lowestprime[num]!=1)
    {
        m[lowestprime[num]]++;
        num /= lowestprime[num];
    }
}

void solve()
{
    ll n,a; cin>>n;
    map<ll,ll>m;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        primefactor(a,m);
    }
    ll ans=1,mod=1e9+7;
    for(auto e:m)
    {
        ans *= (e.second+1);
        ans %=mod;
    }
    cout<<ans<<endl;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    seivelp();
    solve();
}

Information

Submit By
Type
Submission
Problem
P1060 Divisor
Language
C++20 (G++ 13.2.0)
Submit At
2024-06-09 13:52:09
Judged At
2024-11-11 03:28:58
Judged By
Score
100
Total Time
77ms
Peak Memory
10.836 MiB