# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7913 |
2014-08-24T13:05:22 Z |
gs13068 |
경비원 (GA8_guard) |
C++ |
|
512 ms |
1516 KB |
#include<cstdio>
#include<vector>
#include<algorithm>
#define MOD 1000000007
std::vector<int> a[2222];
int p[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int d[2][32768];
int main()
{
int *now,*next,*temp;
int i,j,k,n,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&t);
k=0;
for(j=0;j<15;j++)if(t%p[j]==0)
{
k|=1<<j;
while(t%p[j]==0)t/=p[j];
}
a[t].push_back(k);
}
now=d[0];
next=d[1];
now[0]=1;
for(i=0;i<a[1].size();i++)
{
for(j=0;j<32768;j++)
{
next[j]=now[j];
if((j&a[1][i])==a[1][i])(next[j]+=now[j&~a[1][i]])%=MOD;
}
temp=now;
now=next;
next=temp;
}
for(i=2;i<2222;i++)if(a[i].size())
{
for(j=0;j<32768;j++)
{
next[j]=now[j];
for(k=0;k<a[i].size();k++)if((j&a[i][k])==a[i][k])(next[j]+=now[j&~a[i][k]])%=MOD;
}
temp=now;
now=next;
next=temp;
}
i=0;
for(j=0;j<32768;j++)(i+=now[j])%=MOD;
printf("%d",i-n-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1516 KB |
Output is correct |
2 |
Correct |
0 ms |
1516 KB |
Output is correct |
3 |
Correct |
0 ms |
1516 KB |
Output is correct |
4 |
Correct |
0 ms |
1516 KB |
Output is correct |
5 |
Correct |
0 ms |
1516 KB |
Output is correct |
6 |
Correct |
0 ms |
1516 KB |
Output is correct |
7 |
Correct |
0 ms |
1516 KB |
Output is correct |
8 |
Correct |
0 ms |
1516 KB |
Output is correct |
9 |
Correct |
0 ms |
1516 KB |
Output is correct |
10 |
Correct |
0 ms |
1516 KB |
Output is correct |
11 |
Correct |
4 ms |
1516 KB |
Output is correct |
12 |
Correct |
0 ms |
1516 KB |
Output is correct |
13 |
Correct |
0 ms |
1516 KB |
Output is correct |
14 |
Correct |
0 ms |
1516 KB |
Output is correct |
15 |
Correct |
0 ms |
1516 KB |
Output is correct |
16 |
Correct |
0 ms |
1516 KB |
Output is correct |
17 |
Correct |
0 ms |
1516 KB |
Output is correct |
18 |
Correct |
0 ms |
1516 KB |
Output is correct |
19 |
Correct |
0 ms |
1516 KB |
Output is correct |
20 |
Correct |
0 ms |
1516 KB |
Output is correct |
21 |
Correct |
0 ms |
1516 KB |
Output is correct |
22 |
Correct |
0 ms |
1516 KB |
Output is correct |
23 |
Correct |
0 ms |
1516 KB |
Output is correct |
24 |
Correct |
0 ms |
1516 KB |
Output is correct |
25 |
Correct |
0 ms |
1516 KB |
Output is correct |
26 |
Correct |
0 ms |
1516 KB |
Output is correct |
27 |
Correct |
0 ms |
1516 KB |
Output is correct |
28 |
Correct |
0 ms |
1516 KB |
Output is correct |
29 |
Correct |
4 ms |
1516 KB |
Output is correct |
30 |
Correct |
4 ms |
1516 KB |
Output is correct |
31 |
Correct |
0 ms |
1516 KB |
Output is correct |
32 |
Correct |
0 ms |
1516 KB |
Output is correct |
33 |
Correct |
0 ms |
1516 KB |
Output is correct |
34 |
Correct |
0 ms |
1516 KB |
Output is correct |
35 |
Correct |
0 ms |
1516 KB |
Output is correct |
36 |
Correct |
0 ms |
1516 KB |
Output is correct |
37 |
Correct |
0 ms |
1516 KB |
Output is correct |
38 |
Correct |
0 ms |
1516 KB |
Output is correct |
39 |
Correct |
0 ms |
1516 KB |
Output is correct |
40 |
Correct |
0 ms |
1516 KB |
Output is correct |
41 |
Correct |
0 ms |
1516 KB |
Output is correct |
42 |
Correct |
4 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1516 KB |
Output is correct |
2 |
Correct |
0 ms |
1516 KB |
Output is correct |
3 |
Correct |
0 ms |
1516 KB |
Output is correct |
4 |
Correct |
0 ms |
1516 KB |
Output is correct |
5 |
Correct |
0 ms |
1516 KB |
Output is correct |
6 |
Correct |
0 ms |
1516 KB |
Output is correct |
7 |
Correct |
0 ms |
1516 KB |
Output is correct |
8 |
Correct |
0 ms |
1516 KB |
Output is correct |
9 |
Correct |
0 ms |
1516 KB |
Output is correct |
10 |
Correct |
0 ms |
1516 KB |
Output is correct |
11 |
Correct |
0 ms |
1516 KB |
Output is correct |
12 |
Correct |
0 ms |
1516 KB |
Output is correct |
13 |
Correct |
0 ms |
1516 KB |
Output is correct |
14 |
Correct |
0 ms |
1516 KB |
Output is correct |
15 |
Correct |
0 ms |
1516 KB |
Output is correct |
16 |
Correct |
0 ms |
1516 KB |
Output is correct |
17 |
Correct |
0 ms |
1516 KB |
Output is correct |
18 |
Correct |
0 ms |
1516 KB |
Output is correct |
19 |
Correct |
0 ms |
1516 KB |
Output is correct |
20 |
Correct |
0 ms |
1516 KB |
Output is correct |
21 |
Correct |
0 ms |
1516 KB |
Output is correct |
22 |
Correct |
0 ms |
1516 KB |
Output is correct |
23 |
Correct |
0 ms |
1516 KB |
Output is correct |
24 |
Correct |
0 ms |
1516 KB |
Output is correct |
25 |
Correct |
0 ms |
1516 KB |
Output is correct |
26 |
Correct |
0 ms |
1516 KB |
Output is correct |
27 |
Correct |
0 ms |
1516 KB |
Output is correct |
28 |
Correct |
0 ms |
1516 KB |
Output is correct |
29 |
Correct |
4 ms |
1516 KB |
Output is correct |
30 |
Correct |
0 ms |
1516 KB |
Output is correct |
31 |
Correct |
4 ms |
1516 KB |
Output is correct |
32 |
Correct |
4 ms |
1516 KB |
Output is correct |
33 |
Correct |
0 ms |
1516 KB |
Output is correct |
34 |
Correct |
4 ms |
1516 KB |
Output is correct |
35 |
Correct |
4 ms |
1516 KB |
Output is correct |
36 |
Correct |
4 ms |
1516 KB |
Output is correct |
37 |
Correct |
0 ms |
1516 KB |
Output is correct |
38 |
Correct |
4 ms |
1516 KB |
Output is correct |
39 |
Correct |
4 ms |
1516 KB |
Output is correct |
40 |
Correct |
4 ms |
1516 KB |
Output is correct |
41 |
Correct |
4 ms |
1516 KB |
Output is correct |
42 |
Correct |
4 ms |
1516 KB |
Output is correct |
43 |
Correct |
4 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
188 ms |
1516 KB |
Output is correct |
2 |
Correct |
188 ms |
1516 KB |
Output is correct |
3 |
Correct |
352 ms |
1516 KB |
Output is correct |
4 |
Correct |
176 ms |
1516 KB |
Output is correct |
5 |
Correct |
288 ms |
1516 KB |
Output is correct |
6 |
Correct |
216 ms |
1516 KB |
Output is correct |
7 |
Correct |
164 ms |
1516 KB |
Output is correct |
8 |
Correct |
156 ms |
1516 KB |
Output is correct |
9 |
Correct |
172 ms |
1516 KB |
Output is correct |
10 |
Correct |
176 ms |
1516 KB |
Output is correct |
11 |
Correct |
328 ms |
1516 KB |
Output is correct |
12 |
Correct |
164 ms |
1516 KB |
Output is correct |
13 |
Correct |
280 ms |
1516 KB |
Output is correct |
14 |
Correct |
212 ms |
1516 KB |
Output is correct |
15 |
Correct |
156 ms |
1516 KB |
Output is correct |
16 |
Correct |
148 ms |
1516 KB |
Output is correct |
17 |
Correct |
152 ms |
1516 KB |
Output is correct |
18 |
Correct |
160 ms |
1516 KB |
Output is correct |
19 |
Correct |
308 ms |
1516 KB |
Output is correct |
20 |
Correct |
152 ms |
1516 KB |
Output is correct |
21 |
Correct |
248 ms |
1516 KB |
Output is correct |
22 |
Correct |
200 ms |
1516 KB |
Output is correct |
23 |
Correct |
140 ms |
1516 KB |
Output is correct |
24 |
Correct |
136 ms |
1516 KB |
Output is correct |
25 |
Correct |
136 ms |
1516 KB |
Output is correct |
26 |
Correct |
136 ms |
1516 KB |
Output is correct |
27 |
Correct |
240 ms |
1516 KB |
Output is correct |
28 |
Correct |
128 ms |
1516 KB |
Output is correct |
29 |
Correct |
216 ms |
1516 KB |
Output is correct |
30 |
Correct |
164 ms |
1516 KB |
Output is correct |
31 |
Correct |
120 ms |
1516 KB |
Output is correct |
32 |
Correct |
120 ms |
1516 KB |
Output is correct |
33 |
Correct |
108 ms |
1516 KB |
Output is correct |
34 |
Correct |
108 ms |
1516 KB |
Output is correct |
35 |
Correct |
172 ms |
1516 KB |
Output is correct |
36 |
Correct |
100 ms |
1516 KB |
Output is correct |
37 |
Correct |
168 ms |
1516 KB |
Output is correct |
38 |
Correct |
116 ms |
1516 KB |
Output is correct |
39 |
Correct |
96 ms |
1516 KB |
Output is correct |
40 |
Correct |
92 ms |
1516 KB |
Output is correct |
41 |
Correct |
212 ms |
1516 KB |
Output is correct |
42 |
Correct |
208 ms |
1516 KB |
Output is correct |
43 |
Correct |
212 ms |
1516 KB |
Output is correct |
44 |
Correct |
212 ms |
1516 KB |
Output is correct |
45 |
Correct |
212 ms |
1516 KB |
Output is correct |
46 |
Correct |
212 ms |
1516 KB |
Output is correct |
47 |
Correct |
216 ms |
1516 KB |
Output is correct |
48 |
Correct |
208 ms |
1516 KB |
Output is correct |
49 |
Correct |
220 ms |
1516 KB |
Output is correct |
50 |
Correct |
216 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
1516 KB |
Output is correct |
2 |
Correct |
244 ms |
1516 KB |
Output is correct |
3 |
Correct |
224 ms |
1516 KB |
Output is correct |
4 |
Correct |
176 ms |
1516 KB |
Output is correct |
5 |
Correct |
132 ms |
1516 KB |
Output is correct |
6 |
Correct |
136 ms |
1516 KB |
Output is correct |
7 |
Correct |
144 ms |
1516 KB |
Output is correct |
8 |
Correct |
132 ms |
1516 KB |
Output is correct |
9 |
Correct |
132 ms |
1516 KB |
Output is correct |
10 |
Correct |
136 ms |
1516 KB |
Output is correct |
11 |
Correct |
132 ms |
1516 KB |
Output is correct |
12 |
Correct |
80 ms |
1516 KB |
Output is correct |
13 |
Correct |
80 ms |
1516 KB |
Output is correct |
14 |
Correct |
80 ms |
1516 KB |
Output is correct |
15 |
Correct |
80 ms |
1516 KB |
Output is correct |
16 |
Correct |
72 ms |
1516 KB |
Output is correct |
17 |
Correct |
80 ms |
1516 KB |
Output is correct |
18 |
Correct |
76 ms |
1516 KB |
Output is correct |
19 |
Correct |
16 ms |
1516 KB |
Output is correct |
20 |
Correct |
16 ms |
1516 KB |
Output is correct |
21 |
Correct |
20 ms |
1516 KB |
Output is correct |
22 |
Correct |
16 ms |
1516 KB |
Output is correct |
23 |
Correct |
16 ms |
1516 KB |
Output is correct |
24 |
Correct |
16 ms |
1516 KB |
Output is correct |
25 |
Correct |
16 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
248 ms |
1516 KB |
Output is correct |
2 |
Correct |
248 ms |
1516 KB |
Output is correct |
3 |
Correct |
264 ms |
1516 KB |
Output is correct |
4 |
Correct |
216 ms |
1516 KB |
Output is correct |
5 |
Correct |
188 ms |
1516 KB |
Output is correct |
6 |
Correct |
172 ms |
1516 KB |
Output is correct |
7 |
Correct |
296 ms |
1516 KB |
Output is correct |
8 |
Correct |
172 ms |
1516 KB |
Output is correct |
9 |
Correct |
148 ms |
1516 KB |
Output is correct |
10 |
Correct |
512 ms |
1516 KB |
Output is correct |
11 |
Correct |
232 ms |
1516 KB |
Output is correct |
12 |
Correct |
244 ms |
1516 KB |
Output is correct |
13 |
Correct |
240 ms |
1516 KB |
Output is correct |
14 |
Correct |
208 ms |
1516 KB |
Output is correct |
15 |
Correct |
176 ms |
1516 KB |
Output is correct |
16 |
Correct |
164 ms |
1516 KB |
Output is correct |
17 |
Correct |
280 ms |
1516 KB |
Output is correct |
18 |
Correct |
164 ms |
1516 KB |
Output is correct |
19 |
Correct |
144 ms |
1516 KB |
Output is correct |
20 |
Correct |
484 ms |
1516 KB |
Output is correct |
21 |
Correct |
216 ms |
1516 KB |
Output is correct |
22 |
Correct |
216 ms |
1516 KB |
Output is correct |
23 |
Correct |
220 ms |
1516 KB |
Output is correct |
24 |
Correct |
188 ms |
1516 KB |
Output is correct |
25 |
Correct |
160 ms |
1516 KB |
Output is correct |
26 |
Correct |
152 ms |
1516 KB |
Output is correct |
27 |
Correct |
248 ms |
1516 KB |
Output is correct |
28 |
Correct |
152 ms |
1516 KB |
Output is correct |
29 |
Correct |
132 ms |
1516 KB |
Output is correct |
30 |
Correct |
444 ms |
1516 KB |
Output is correct |
31 |
Correct |
184 ms |
1516 KB |
Output is correct |
32 |
Correct |
188 ms |
1516 KB |
Output is correct |
33 |
Correct |
180 ms |
1516 KB |
Output is correct |
34 |
Correct |
160 ms |
1516 KB |
Output is correct |
35 |
Correct |
140 ms |
1516 KB |
Output is correct |
36 |
Correct |
128 ms |
1516 KB |
Output is correct |
37 |
Correct |
212 ms |
1516 KB |
Output is correct |
38 |
Correct |
128 ms |
1516 KB |
Output is correct |
39 |
Correct |
112 ms |
1516 KB |
Output is correct |
40 |
Correct |
376 ms |
1516 KB |
Output is correct |