Submission #7293

# Submission time Handle Problem Language Result Execution time Memory
7293 2014-07-30T05:26:51 Z gs13068 경비원 (GA8_guard) C++
37 / 100
2000 ms 1104 KB
#include<cstdio>

int a[2223];
int d[2223];
int max;

int dfs(int x)
{
	if(x>max)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(x+1)*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(x+1))%1000000007;
}

int main()
{
	int i,n,t;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
	{
		scanf("%d",&t);
		a[t]++;
		if(t>max)max=t;
	}
	t=dfs(2);
	for(i=1;i<=a[1];i++)t=(t<<1)%1000000007;
	printf("%d",t-n-1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1104 KB Output is correct
2 Correct 0 ms 1104 KB Output is correct
3 Correct 0 ms 1104 KB Output is correct
4 Correct 0 ms 1104 KB Output is correct
5 Correct 0 ms 1104 KB Output is correct
6 Correct 0 ms 1104 KB Output is correct
7 Correct 0 ms 1104 KB Output is correct
8 Correct 0 ms 1104 KB Output is correct
9 Correct 4 ms 1104 KB Output is correct
10 Correct 0 ms 1104 KB Output is correct
11 Correct 4 ms 1104 KB Output is correct
12 Correct 0 ms 1104 KB Output is correct
13 Correct 0 ms 1104 KB Output is correct
14 Correct 0 ms 1104 KB Output is correct
15 Correct 0 ms 1104 KB Output is correct
16 Correct 0 ms 1104 KB Output is correct
17 Correct 0 ms 1104 KB Output is correct
18 Correct 0 ms 1104 KB Output is correct
19 Correct 0 ms 1104 KB Output is correct
20 Correct 0 ms 1104 KB Output is correct
21 Correct 0 ms 1104 KB Output is correct
22 Correct 0 ms 1104 KB Output is correct
23 Correct 0 ms 1104 KB Output is correct
24 Correct 0 ms 1104 KB Output is correct
25 Correct 0 ms 1104 KB Output is correct
26 Correct 0 ms 1104 KB Output is correct
27 Correct 0 ms 1104 KB Output is correct
28 Correct 0 ms 1104 KB Output is correct
29 Correct 0 ms 1104 KB Output is correct
30 Correct 0 ms 1104 KB Output is correct
31 Correct 0 ms 1104 KB Output is correct
32 Correct 0 ms 1104 KB Output is correct
33 Correct 0 ms 1104 KB Output is correct
34 Correct 0 ms 1104 KB Output is correct
35 Correct 0 ms 1104 KB Output is correct
36 Correct 0 ms 1104 KB Output is correct
37 Correct 0 ms 1104 KB Output is correct
38 Correct 0 ms 1104 KB Output is correct
39 Correct 0 ms 1104 KB Output is correct
40 Correct 0 ms 1104 KB Output is correct
41 Correct 0 ms 1104 KB Output is correct
42 Correct 0 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1104 KB Output is correct
2 Correct 0 ms 1104 KB Output is correct
3 Correct 0 ms 1104 KB Output is correct
4 Correct 0 ms 1104 KB Output is correct
5 Correct 0 ms 1104 KB Output is correct
6 Correct 0 ms 1104 KB Output is correct
7 Correct 0 ms 1104 KB Output is correct
8 Correct 0 ms 1104 KB Output is correct
9 Correct 0 ms 1104 KB Output is correct
10 Correct 0 ms 1104 KB Output is correct
11 Correct 0 ms 1104 KB Output is correct
12 Correct 0 ms 1104 KB Output is correct
13 Correct 0 ms 1104 KB Output is correct
14 Correct 0 ms 1104 KB Output is correct
15 Correct 0 ms 1104 KB Output is correct
16 Correct 0 ms 1104 KB Output is correct
17 Correct 0 ms 1104 KB Output is correct
18 Correct 0 ms 1104 KB Output is correct
19 Correct 0 ms 1104 KB Output is correct
20 Correct 0 ms 1104 KB Output is correct
21 Correct 0 ms 1104 KB Output is correct
22 Correct 0 ms 1104 KB Output is correct
23 Correct 0 ms 1104 KB Output is correct
24 Correct 0 ms 1104 KB Output is correct
25 Correct 0 ms 1104 KB Output is correct
26 Correct 0 ms 1104 KB Output is correct
27 Correct 0 ms 1104 KB Output is correct
28 Correct 0 ms 1104 KB Output is correct
29 Correct 0 ms 1104 KB Output is correct
30 Correct 4 ms 1104 KB Output is correct
31 Correct 4 ms 1104 KB Output is correct
32 Correct 4 ms 1104 KB Output is correct
33 Correct 0 ms 1104 KB Output is correct
34 Correct 8 ms 1104 KB Output is correct
35 Correct 8 ms 1104 KB Output is correct
36 Correct 12 ms 1104 KB Output is correct
37 Correct 12 ms 1104 KB Output is correct
38 Correct 16 ms 1104 KB Output is correct
39 Correct 16 ms 1104 KB Output is correct
40 Correct 28 ms 1104 KB Output is correct
41 Correct 32 ms 1104 KB Output is correct
42 Correct 52 ms 1104 KB Output is correct
43 Correct 60 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 1104 KB Output is correct
2 Correct 60 ms 1104 KB Output is correct
3 Correct 48 ms 1104 KB Output is correct
4 Correct 0 ms 1104 KB Output is correct
5 Correct 0 ms 1104 KB Output is correct
6 Correct 0 ms 1104 KB Output is correct
7 Correct 0 ms 1104 KB Output is correct
8 Correct 0 ms 1104 KB Output is correct
9 Correct 60 ms 1104 KB Output is correct
10 Correct 60 ms 1104 KB Output is correct
11 Correct 56 ms 1104 KB Output is correct
12 Correct 0 ms 1104 KB Output is correct
13 Correct 0 ms 1104 KB Output is correct
14 Correct 0 ms 1104 KB Output is correct
15 Correct 0 ms 1104 KB Output is correct
16 Correct 0 ms 1104 KB Output is correct
17 Correct 60 ms 1104 KB Output is correct
18 Correct 60 ms 1104 KB Output is correct
19 Correct 60 ms 1104 KB Output is correct
20 Correct 0 ms 1104 KB Output is correct
21 Correct 0 ms 1104 KB Output is correct
22 Correct 0 ms 1104 KB Output is correct
23 Correct 0 ms 1104 KB Output is correct
24 Correct 0 ms 1104 KB Output is correct
25 Correct 60 ms 1104 KB Output is correct
26 Correct 60 ms 1104 KB Output is correct
27 Correct 60 ms 1104 KB Output is correct
28 Correct 0 ms 1104 KB Output is correct
29 Correct 0 ms 1104 KB Output is correct
30 Correct 0 ms 1104 KB Output is correct
31 Correct 0 ms 1104 KB Output is correct
32 Correct 0 ms 1104 KB Output is correct
33 Correct 60 ms 1104 KB Output is correct
34 Correct 60 ms 1104 KB Output is correct
35 Correct 60 ms 1104 KB Output is correct
36 Correct 0 ms 1104 KB Output is correct
37 Correct 0 ms 1104 KB Output is correct
38 Correct 0 ms 1104 KB Output is correct
39 Correct 0 ms 1104 KB Output is correct
40 Correct 0 ms 1104 KB Output is correct
41 Correct 12 ms 1104 KB Output is correct
42 Correct 8 ms 1104 KB Output is correct
43 Correct 12 ms 1104 KB Output is correct
44 Correct 16 ms 1104 KB Output is correct
45 Correct 24 ms 1104 KB Output is correct
46 Correct 12 ms 1104 KB Output is correct
47 Correct 12 ms 1104 KB Output is correct
48 Correct 8 ms 1104 KB Output is correct
49 Correct 4 ms 1104 KB Output is correct
50 Correct 12 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 1100 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 1100 KB Program timed out
2 Halted 0 ms 0 KB -