/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 83ms 1.742 MiB
#2 Accepted 82ms 1.742 MiB
#3 Accepted 82ms 1.746 MiB
#4 Accepted 102ms 1.738 MiB
#5 Accepted 181ms 3.566 MiB
#6 Accepted 125ms 1.746 MiB
#7 Accepted 126ms 2.195 MiB
#8 Accepted 279ms 1.746 MiB
#9 Accepted 132ms 2.246 MiB
#10 Accepted 90ms 1.742 MiB
#11 Accepted 121ms 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-10-03 13:32:04
Judged By
Score
100
Total Time
279ms
Peak Memory
3.566 MiB