Submission #7292

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

int a[2223];
int d[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+=dfs(x+1)*a[x];

			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);
}

int main()
{
	int i,n,t;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
	{
		scanf("%d",&t);
		a[t]++;
	}
	printf("%d",dfs(1)-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 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 Incorrect 0 ms 1104 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 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 4 ms 1104 KB Output is correct
17 Correct 4 ms 1104 KB Output is correct
18 Correct 8 ms 1104 KB Output is correct
19 Correct 8 ms 1104 KB Output is correct
20 Correct 12 ms 1104 KB Output is correct
21 Correct 12 ms 1104 KB Output is correct
22 Correct 24 ms 1104 KB Output is correct
23 Correct 20 ms 1104 KB Output is correct
24 Correct 36 ms 1104 KB Output is correct
25 Correct 36 ms 1104 KB Output is correct
26 Correct 44 ms 1104 KB Output is correct
27 Correct 48 ms 1104 KB Output is correct
28 Correct 100 ms 1104 KB Output is correct
29 Correct 96 ms 1104 KB Output is correct
30 Correct 196 ms 1104 KB Output is correct
31 Correct 220 ms 1104 KB Output is correct
32 Correct 260 ms 1104 KB Output is correct
33 Correct 256 ms 1104 KB Output is correct
34 Correct 292 ms 1104 KB Output is correct
35 Correct 292 ms 1104 KB Output is correct
36 Correct 584 ms 1104 KB Output is correct
37 Correct 612 ms 1104 KB Output is correct
38 Correct 668 ms 1104 KB Output is correct
39 Correct 688 ms 1104 KB Output is correct
40 Correct 1356 ms 1104 KB Output is correct
41 Correct 1376 ms 1104 KB Output is correct
42 Execution timed out 2000 ms 1104 KB Program timed out
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 1104 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 -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 1100 KB Program timed out
2 Halted 0 ms 0 KB -