Submission #3873216


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
int prime[100000];
bool is_prime[100001];
int sieve(int n){
    int p = 0;
    rep(i,0,n+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    rep(i,2,n+1){
        if (is_prime[i]){
            p++;
            prime[p]=i;
            for (int j=2*i; j<=n; j+=i) is_prime[j]=false;
        }
    }
    return p;
}
int d[1000010];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll l,r;
    cin>>l>>r;
    int c=sieve(int(sqrt(r)));
    rep(i,0,r-l+1){
        ll L=l+i;
        rep(j,1,c+1){
            while(L%prime[j]==0){
                d[i]++;
                L/=prime[j];
            }
        }
        if(L!=1) d[i]++;
    }
    ll ans=0;
    rep(i,0,r-l+1){
        if(is_prime[d[i]]) ans++;
    }
    cout<<ans<<"\n";
}

Submission Info

Submission Time
Task C - Prime-Factor Prime
User yuki1997
Language C++14 (GCC 5.4.1)
Score 0
Code Size 992 Byte
Status TLE
Exec Time 2103 ms
Memory 4352 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 34
TLE × 25
Set Name Test Cases
All 00_sample_00, 00_sample_01, 00_sample_02, 00_sample_03, 00_sample_04, 00_sample_05, 10_small_00, 10_small_01, 10_small_02, 10_small_03, 10_small_04, 10_small_05, 10_small_06, 10_small_07, 10_small_08, 10_small_09, 20_medium_00, 20_medium_01, 20_medium_02, 20_medium_03, 20_medium_04, 20_medium_05, 20_medium_06, 20_medium_07, 20_medium_08, 20_medium_09, 30_medium_00, 30_medium_01, 30_medium_02, 30_medium_03, 30_medium_04, 30_medium_05, 30_medium_06, 30_medium_07, 30_medium_08, 30_medium_09, 40_one_00, 40_one_01, 40_one_02, 50_large_low_00, 50_large_low_01, 50_large_low_02, 50_large_low_03, 50_large_low_04, 60_large_high_00, 60_large_high_01, 60_large_high_02, 60_large_high_03, 60_large_high_04, 70_max_low_00, 70_max_low_01, 70_max_low_02, 70_max_low_03, 70_max_low_04, 80_max_high_00, 80_max_high_01, 80_max_high_02, 80_max_high_03, 80_max_high_04
Case Name Status Exec Time Memory
00_sample_00 AC 2 ms 2304 KB
00_sample_01 AC 2 ms 2304 KB
00_sample_02 AC 38 ms 2560 KB
00_sample_03 AC 2 ms 2304 KB
00_sample_04 AC 470 ms 2688 KB
00_sample_05 TLE 2103 ms 2560 KB
10_small_00 AC 2 ms 2304 KB
10_small_01 AC 2 ms 2304 KB
10_small_02 AC 2 ms 2304 KB
10_small_03 AC 2 ms 2304 KB
10_small_04 AC 2 ms 2304 KB
10_small_05 AC 2 ms 2304 KB
10_small_06 AC 2 ms 2304 KB
10_small_07 AC 2 ms 2304 KB
10_small_08 AC 2 ms 2304 KB
10_small_09 AC 2 ms 2304 KB
20_medium_00 AC 170 ms 2944 KB
20_medium_01 TLE 2103 ms 4352 KB
20_medium_02 AC 1496 ms 4352 KB
20_medium_03 AC 760 ms 3456 KB
20_medium_04 AC 1357 ms 4352 KB
20_medium_05 AC 638 ms 4096 KB
20_medium_06 AC 1640 ms 4352 KB
20_medium_07 AC 1153 ms 3328 KB
20_medium_08 AC 1585 ms 4352 KB
20_medium_09 AC 138 ms 2688 KB
30_medium_00 TLE 2103 ms 4352 KB
30_medium_01 AC 1344 ms 3840 KB
30_medium_02 AC 1860 ms 4352 KB
30_medium_03 AC 1261 ms 4352 KB
30_medium_04 TLE 2103 ms 4352 KB
30_medium_05 AC 1242 ms 4352 KB
30_medium_06 AC 1211 ms 4352 KB
30_medium_07 AC 744 ms 2944 KB
30_medium_08 AC 859 ms 3200 KB
30_medium_09 TLE 2103 ms 4352 KB
40_one_00 AC 2 ms 2304 KB
40_one_01 AC 2 ms 2304 KB
40_one_02 AC 2 ms 2304 KB
50_large_low_00 TLE 2103 ms 4352 KB
50_large_low_01 TLE 2103 ms 3456 KB
50_large_low_02 TLE 2103 ms 3200 KB
50_large_low_03 TLE 2103 ms 3072 KB
50_large_low_04 TLE 2103 ms 2944 KB
60_large_high_00 TLE 2103 ms 2944 KB
60_large_high_01 TLE 2103 ms 3072 KB
60_large_high_02 TLE 2103 ms 3200 KB
60_large_high_03 TLE 2103 ms 3328 KB
60_large_high_04 TLE 2103 ms 3712 KB
70_max_low_00 TLE 2103 ms 3456 KB
70_max_low_01 TLE 2103 ms 2688 KB
70_max_low_02 TLE 2103 ms 2688 KB
70_max_low_03 TLE 2103 ms 2560 KB
70_max_low_04 TLE 2103 ms 2560 KB
80_max_high_00 TLE 2103 ms 2560 KB
80_max_high_01 TLE 2103 ms 2560 KB
80_max_high_02 TLE 2103 ms 2560 KB
80_max_high_03 TLE 2103 ms 2688 KB
80_max_high_04 TLE 2103 ms 2944 KB