/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 2ms 492.0 KiB
#3 Accepted 10ms 576.0 KiB
#4 Accepted 85ms 932.0 KiB
#5 Accepted 288ms 2.191 MiB
#6 Accepted 138ms 924.0 KiB
#7 Accepted 127ms 1.301 MiB
#8 Accepted 475ms 928.0 KiB
#9 Accepted 138ms 1.266 MiB
#10 Accepted 854ms 928.0 KiB
#11 Time Exceeded ≥1016ms ≥2.426 MiB

Code


#include <iostream>
//minhazchyz
#include<bits/stdc++.h>
#include <vector>
#include <map>
#include <cmath>

const int m= 1000000007;
void fact(int num, std::map<int, int> &cnt) {
    for (int i = 2; i <= std::sqrt(num);i++) {
        while (num % i == 0) {
            cnt[i]++;
            num /= i;
        }
    }
    if (num > 1) {
        cnt[num]++;
    }
}
int main() {
    int n;
    std::cin >> n;
    std::vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> A[i];
    }

    std::map<int,int>cnt;
    for (int i = 0; i < n; ++i) {
        fact(A[i],cnt);
    }
    long long td = 1;
    for (const auto&entry:cnt) {
        td=(td* (entry.second + 1)) %m;
    }
    std::cout <<td<< std::endl;
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1060 Divisor
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-18 11:28:05
Judged At
2024-11-11 03:30:06
Judged By
Score
90
Total Time
≥1016ms
Peak Memory
≥2.426 MiB