Submission #7294

#TimeUsernameProblemLanguageResultExecution timeMemory
7294gs13068경비원 (GA8_guard)C++98
37 / 100
2000 ms1112 KiB
#include<cstdio> int a[2223]; int d[2223]; int p[2223]; int dfs(int x) { if(x>2222)return 1; int i,t,r=0; if(a[x]) { t=x; for(i=2;i*i<=t;i++) { if(t%i==0&&d[i])break; while(t%i==0)t/=i; } if(i*i>t&&!d[t]) { t=x; for(i=2;i*i<=t;i++)if(t%i==0) { d[i]=1; while(t%i==0)t/=i; } if(t>1)d[t]=1; r=1LL*dfs(p[x])*a[x]%1000000007; t=x; for(i=2;i*i<=t;i++)if(t%i==0) { d[i]=0; while(t%i==0)t/=i; } if(t>1)d[t]=0; } } return (r+dfs(p[x]))%1000000007; } int main() { int i,n,t; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&t); a[t]++; } t=2223; for(i=2222;i>=2;i--) { p[i]=t; if(a[i])t=i; } t=dfs(2); for(i=1;i<=a[1];i++)t=(t<<1)%1000000007; printf("%d",t-n-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...