Submission #2460978


Source Code Expand

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn=100000;
int cnt=0;
int a[100010];
int prime[100010];
void init();
int main()
{
   // ios::sync_with_stdio(false);
    int l,r;
    init();
    scanf("%d %d",&l,&r);
        int ans=0;
        for(int i=l;i<=r;i++)
        {
                int sum=0,n=i;
                for(int j=0;prime[j]*prime[j]<=n;j++)
                {
                    while(!(n%prime[j]))
                    {
                        n/=prime[j];
                        sum++;
                    }
                }
                if(n!=1)
                    sum++;
                if(!a[sum])
                    ans++;
        }
        printf("%d\n",ans);
    return 0;
}
void init()
{
    a[1]=1;
    a[0]=1;

    for(ll i=2; i<=100000; i++)
    {
        if(!a[i])
        {
            prime[cnt++]=i;
            for(ll j=i*i; j<=100000; j+=i)
            {
                a[j]=1;
            }
        }
    }
}

Submission Info

Submission Time
Task C - Prime-Factor Prime
User hyacinthus
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1113 Byte
Status TLE
Exec Time 2102 ms
Memory 640 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&l,&r);
                         ^

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 57
TLE × 2
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 640 KB
00_sample_01 AC 2 ms 640 KB
00_sample_02 AC 8 ms 640 KB
00_sample_03 AC 2 ms 640 KB
00_sample_04 AC 45 ms 640 KB
00_sample_05 TLE 2098 ms 640 KB
10_small_00 AC 2 ms 640 KB
10_small_01 AC 2 ms 640 KB
10_small_02 AC 2 ms 640 KB
10_small_03 AC 2 ms 640 KB
10_small_04 AC 2 ms 640 KB
10_small_05 AC 2 ms 640 KB
10_small_06 AC 2 ms 640 KB
10_small_07 AC 2 ms 640 KB
10_small_08 AC 2 ms 640 KB
10_small_09 AC 2 ms 640 KB
20_medium_00 AC 26 ms 640 KB
20_medium_01 AC 273 ms 640 KB
20_medium_02 AC 160 ms 640 KB
20_medium_03 AC 85 ms 640 KB
20_medium_04 AC 151 ms 640 KB
20_medium_05 AC 75 ms 640 KB
20_medium_06 AC 174 ms 640 KB
20_medium_07 AC 110 ms 640 KB
20_medium_08 AC 171 ms 640 KB
20_medium_09 AC 19 ms 640 KB
30_medium_00 AC 270 ms 640 KB
30_medium_01 AC 138 ms 640 KB
30_medium_02 AC 193 ms 640 KB
30_medium_03 AC 140 ms 640 KB
30_medium_04 AC 270 ms 640 KB
30_medium_05 AC 138 ms 640 KB
30_medium_06 AC 137 ms 640 KB
30_medium_07 AC 72 ms 640 KB
30_medium_08 AC 87 ms 640 KB
30_medium_09 AC 275 ms 640 KB
40_one_00 AC 2 ms 640 KB
40_one_01 AC 2 ms 640 KB
40_one_02 AC 2 ms 640 KB
50_large_low_00 AC 287 ms 640 KB
50_large_low_01 AC 609 ms 640 KB
50_large_low_02 AC 717 ms 640 KB
50_large_low_03 AC 807 ms 640 KB
50_large_low_04 AC 870 ms 640 KB
60_large_high_00 AC 894 ms 640 KB
60_large_high_01 AC 833 ms 640 KB
60_large_high_02 AC 732 ms 640 KB
60_large_high_03 AC 668 ms 640 KB
60_large_high_04 AC 514 ms 640 KB
70_max_low_00 AC 576 ms 640 KB
70_max_low_01 AC 1315 ms 640 KB
70_max_low_02 AC 1566 ms 640 KB
70_max_low_03 AC 1790 ms 640 KB
70_max_low_04 AC 1967 ms 640 KB
80_max_high_00 TLE 2102 ms 640 KB
80_max_high_01 AC 1857 ms 640 KB
80_max_high_02 AC 1680 ms 640 KB
80_max_high_03 AC 1476 ms 640 KB
80_max_high_04 AC 981 ms 640 KB