/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 82ms 1.746 MiB
#2 Accepted 79ms 1.746 MiB
#3 Accepted 81ms 1.734 MiB
#4 Accepted 107ms 1.746 MiB
#5 Accepted 181ms 3.484 MiB
#6 Accepted 122ms 1.746 MiB
#7 Accepted 123ms 2.238 MiB
#8 Accepted 279ms 1.746 MiB
#9 Accepted 133ms 2.199 MiB
#10 Accepted 90ms 1.738 MiB
#11 Accepted 123ms 1.738 MiB

Code

/*
    BISMILLAHIR RAHMANIR RAHIM
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
ll mod=1e9+7;
vector<bool> prime(1e7+1,1);
void seive()
{
     prime[0]=prime[1]=false;
    for(long long i=2;i<=1e7;i++)
    {
        if(prime[i]){
            for(long long j=i*i;j<=1e7;j+=i)
            {
                prime[j]=false;
            }
        }
    }
}
void solve()
{
    ll n;cin>>n;
    map<ll,ll> mp;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        if(prime[x])
        {
            mp[x]++;continue;
        }
        for(int j=2;j*j<=x;j++)
        {
            if(x%j==0)
            {
                while(x%j==0)
                {
                    mp[j]++;x/=j;
                }
            }
        }
        if(x!=1)mp[x]++;
    }
    ll ans=1;
    for(auto it:mp)
    {
        ans*=(it.second+1);ans%=mod;
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    seive();
    //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1060 Divisor
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-15 19:07:06
Judged At
2024-11-11 03:19:38
Judged By
Score
100
Total Time
279ms
Peak Memory
3.484 MiB