/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 7ms 580.0 KiB
#4 Accepted 53ms 924.0 KiB
#5 Accepted 188ms 2.191 MiB
#6 Accepted 85ms 928.0 KiB
#7 Accepted 84ms 1.316 MiB
#8 Accepted 304ms 932.0 KiB
#9 Accepted 97ms 1.25 MiB
#10 Accepted 503ms 924.0 KiB
#11 Time Exceeded ≥1082ms ≥2.27 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:34:42
Judged At
2024-11-11 03:30:06
Judged By
Score
90
Total Time
≥1082ms
Peak Memory
≥2.27 MiB