Submission #3873200
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[1000]; bool is_prime[1001]; 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[1000000]; 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 | 988 Byte |
Status | RE |
Exec Time | 1643 ms |
Memory | 3840 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
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 | 1 ms | 256 KB |
00_sample_01 | AC | 1 ms | 256 KB |
00_sample_02 | AC | 38 ms | 512 KB |
00_sample_03 | AC | 1 ms | 256 KB |
00_sample_04 | RE | 100 ms | 256 KB |
00_sample_05 | RE | 100 ms | 256 KB |
10_small_00 | AC | 1 ms | 256 KB |
10_small_01 | AC | 1 ms | 256 KB |
10_small_02 | AC | 1 ms | 256 KB |
10_small_03 | AC | 2 ms | 256 KB |
10_small_04 | AC | 1 ms | 256 KB |
10_small_05 | AC | 1 ms | 256 KB |
10_small_06 | AC | 1 ms | 256 KB |
10_small_07 | AC | 1 ms | 256 KB |
10_small_08 | AC | 1 ms | 256 KB |
10_small_09 | AC | 1 ms | 256 KB |
20_medium_00 | AC | 169 ms | 896 KB |
20_medium_01 | RE | 99 ms | 256 KB |
20_medium_02 | RE | 99 ms | 256 KB |
20_medium_03 | RE | 100 ms | 256 KB |
20_medium_04 | RE | 100 ms | 256 KB |
20_medium_05 | AC | 638 ms | 2048 KB |
20_medium_06 | AC | 1643 ms | 3840 KB |
20_medium_07 | RE | 101 ms | 256 KB |
20_medium_08 | AC | 1586 ms | 3584 KB |
20_medium_09 | AC | 138 ms | 640 KB |
30_medium_00 | RE | 103 ms | 256 KB |
30_medium_01 | RE | 100 ms | 256 KB |
30_medium_02 | RE | 102 ms | 256 KB |
30_medium_03 | RE | 100 ms | 256 KB |
30_medium_04 | RE | 102 ms | 256 KB |
30_medium_05 | RE | 100 ms | 256 KB |
30_medium_06 | RE | 100 ms | 256 KB |
30_medium_07 | RE | 101 ms | 256 KB |
30_medium_08 | RE | 101 ms | 256 KB |
30_medium_09 | RE | 101 ms | 256 KB |
40_one_00 | RE | 102 ms | 256 KB |
40_one_01 | RE | 100 ms | 256 KB |
40_one_02 | RE | 100 ms | 256 KB |
50_large_low_00 | RE | 100 ms | 256 KB |
50_large_low_01 | RE | 100 ms | 256 KB |
50_large_low_02 | RE | 101 ms | 256 KB |
50_large_low_03 | RE | 103 ms | 256 KB |
50_large_low_04 | RE | 100 ms | 256 KB |
60_large_high_00 | RE | 101 ms | 256 KB |
60_large_high_01 | RE | 101 ms | 256 KB |
60_large_high_02 | RE | 100 ms | 256 KB |
60_large_high_03 | RE | 100 ms | 256 KB |
60_large_high_04 | RE | 100 ms | 256 KB |
70_max_low_00 | RE | 101 ms | 256 KB |
70_max_low_01 | RE | 100 ms | 256 KB |
70_max_low_02 | RE | 104 ms | 256 KB |
70_max_low_03 | RE | 101 ms | 256 KB |
70_max_low_04 | RE | 100 ms | 256 KB |
80_max_high_00 | RE | 100 ms | 256 KB |
80_max_high_01 | RE | 100 ms | 256 KB |
80_max_high_02 | RE | 99 ms | 256 KB |
80_max_high_03 | RE | 100 ms | 256 KB |
80_max_high_04 | RE | 101 ms | 256 KB |