Submission #2457669
Source Code Expand
#include<bits/stdc++.h> using namespace std; const int Max=4e4; const int Len=1000000; int prime[Max],prime1[Max]; int num[Len],flag[Len]; int n,m,number; void is_prime() { prime1[0]=1; prime1[1]=1; for(int i=2;i<Max;i++) { if(prime1[i]==0) { prime[++number]=i; for(int j=i+i;j<Max;j+=i) { prime1[j]=1; } } } } int main() { is_prime(); while(scanf("%d%d",&n,&m)!=-1) { for(int i=1;i<=m-n+1;i++) { num[i]=n+i-1; } memset(flag,0,sizeof(flag)); for(int i=1;i<=number;i++) { for(int j=1;j<=m-n+1;j++) { while(prime[i]<=num[j]&&num[j]%prime[i]==0) { num[j]/=prime[i]; flag[j]++; } } } int sum=0; for(int i=1;i<=m-n+1;i++) { if(num[i]==1&&prime1[flag[i]]==0) { sum++; } else if(num[i]!=1&&prime1[flag[i]+1]==0) { sum++; } } printf("%d\n",sum); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Prime-Factor Prime |
User | shuzijun07 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1201 Byte |
Status | TLE |
Exec Time | 2107 ms |
Memory | 8192 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 | 3 ms | 4480 KB |
00_sample_01 | AC | 3 ms | 4480 KB |
00_sample_02 | AC | 463 ms | 6528 KB |
00_sample_03 | AC | 3 ms | 4480 KB |
00_sample_04 | TLE | 2103 ms | 6528 KB |
00_sample_05 | TLE | 2104 ms | 8192 KB |
10_small_00 | AC | 4 ms | 4480 KB |
10_small_01 | AC | 4 ms | 4480 KB |
10_small_02 | AC | 3 ms | 4480 KB |
10_small_03 | AC | 4 ms | 4480 KB |
10_small_04 | AC | 3 ms | 4480 KB |
10_small_05 | AC | 4 ms | 4480 KB |
10_small_06 | AC | 5 ms | 4480 KB |
10_small_07 | AC | 4 ms | 4480 KB |
10_small_08 | AC | 3 ms | 4480 KB |
10_small_09 | AC | 4 ms | 4480 KB |
20_medium_00 | TLE | 2103 ms | 6528 KB |
20_medium_01 | TLE | 2103 ms | 7040 KB |
20_medium_02 | TLE | 2103 ms | 6528 KB |
20_medium_03 | TLE | 2103 ms | 6528 KB |
20_medium_04 | TLE | 2103 ms | 6784 KB |
20_medium_05 | TLE | 2103 ms | 6528 KB |
20_medium_06 | TLE | 2104 ms | 7808 KB |
20_medium_07 | TLE | 2103 ms | 6528 KB |
20_medium_08 | TLE | 2103 ms | 7680 KB |
20_medium_09 | AC | 1503 ms | 6528 KB |
30_medium_00 | TLE | 2104 ms | 7808 KB |
30_medium_01 | TLE | 2103 ms | 6528 KB |
30_medium_02 | TLE | 2103 ms | 6784 KB |
30_medium_03 | TLE | 2103 ms | 6528 KB |
30_medium_04 | TLE | 2103 ms | 7680 KB |
30_medium_05 | TLE | 2103 ms | 6528 KB |
30_medium_06 | TLE | 2103 ms | 6656 KB |
30_medium_07 | TLE | 2103 ms | 6528 KB |
30_medium_08 | TLE | 2107 ms | 6528 KB |
30_medium_09 | TLE | 2103 ms | 7296 KB |
40_one_00 | AC | 3 ms | 4480 KB |
40_one_01 | AC | 3 ms | 4480 KB |
40_one_02 | AC | 3 ms | 4480 KB |
50_large_low_00 | TLE | 2104 ms | 8192 KB |
50_large_low_01 | TLE | 2104 ms | 8192 KB |
50_large_low_02 | TLE | 2104 ms | 8192 KB |
50_large_low_03 | TLE | 2104 ms | 8192 KB |
50_large_low_04 | TLE | 2103 ms | 8192 KB |
60_large_high_00 | TLE | 2104 ms | 8192 KB |
60_large_high_01 | TLE | 2104 ms | 8192 KB |
60_large_high_02 | TLE | 2104 ms | 8192 KB |
60_large_high_03 | TLE | 2103 ms | 8192 KB |
60_large_high_04 | TLE | 2104 ms | 8192 KB |
70_max_low_00 | TLE | 2104 ms | 8192 KB |
70_max_low_01 | TLE | 2104 ms | 8192 KB |
70_max_low_02 | TLE | 2104 ms | 8192 KB |
70_max_low_03 | TLE | 2104 ms | 8192 KB |
70_max_low_04 | TLE | 2104 ms | 8192 KB |
80_max_high_00 | TLE | 2104 ms | 8192 KB |
80_max_high_01 | TLE | 2104 ms | 8192 KB |
80_max_high_02 | TLE | 2104 ms | 8192 KB |
80_max_high_03 | TLE | 2103 ms | 8192 KB |
80_max_high_04 | TLE | 2104 ms | 8192 KB |