# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
14330 |
2015-05-12T03:44:55 Z |
ggoh |
경비원 (GA8_guard) |
C++ |
|
577 ms |
1516 KB |
#include<cstdio>
#include<queue>
#include<algorithm>
int D[2][32768],i,j,k,a,t,s,r,u,X=1e9+7,p[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
std::vector<int>x[2222];
main()
{
scanf("%d",&a);
for(i=0;i<a;i++)
{
scanf("%d",&r);
u=0;
for(j=0;j<15;j++)
{
if(r%p[j]==0)
{
u+=(1<<j);
while(r%p[j]==0)r/=p[j];
}
}
x[r].push_back(u);//r: 1 또는 47 초과 소수
}
//47 초과 소수가 없는 수들에 대해서
u=0;
D[0][0]=1;
for(i=0;i<x[1].size();i++)
{
for(j=0;j<32768;j++)
{
D[1-u][j]=D[u][j];
if((j&x[1][i])==x[1][i])D[1-u][j]+=D[u][j-x[1][i]],D[1-u][j]%=X;
}
u=1-u;
}
//47 초과 있는 수에 대해서
for(i=49;i<2222;i+=2)
{
if(x[i].size())
{
for(j=0;j<32768;j++)
{
D[1-u][j]=D[u][j];
for(k=0;k<x[i].size();k++)
{
if((j&x[i][k])==x[i][k])
{
D[1-u][j]+=D[u][j-x[i][k]];
D[1-u][j]%=X;
}
}
}
u=1-u;
}
}
s=0;
for(i=0;i<32768;i++)s+=D[u][i],s%=X;
printf("%d",(s-a-1+X)%X);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
3 ms |
1516 KB |
Output is correct |
10 |
Correct |
3 ms |
1516 KB |
Output is correct |
11 |
Correct |
4 ms |
1516 KB |
Output is correct |
12 |
Correct |
2 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 |
1 ms |
1516 KB |
Output is correct |
17 |
Correct |
1 ms |
1516 KB |
Output is correct |
18 |
Correct |
0 ms |
1516 KB |
Output is correct |
19 |
Correct |
2 ms |
1516 KB |
Output is correct |
20 |
Correct |
0 ms |
1516 KB |
Output is correct |
21 |
Correct |
2 ms |
1516 KB |
Output is correct |
22 |
Correct |
3 ms |
1516 KB |
Output is correct |
23 |
Correct |
3 ms |
1516 KB |
Output is correct |
24 |
Correct |
3 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 |
4 ms |
1516 KB |
Output is correct |
28 |
Correct |
3 ms |
1516 KB |
Output is correct |
29 |
Correct |
4 ms |
1516 KB |
Output is correct |
30 |
Correct |
5 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 |
2 ms |
1516 KB |
Output is correct |
35 |
Correct |
3 ms |
1516 KB |
Output is correct |
36 |
Correct |
3 ms |
1516 KB |
Output is correct |
37 |
Correct |
0 ms |
1516 KB |
Output is correct |
38 |
Correct |
1 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 |
0 ms |
1516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 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 |
2 ms |
1516 KB |
Output is correct |
9 |
Correct |
2 ms |
1516 KB |
Output is correct |
10 |
Correct |
2 ms |
1516 KB |
Output is correct |
11 |
Correct |
0 ms |
1516 KB |
Output is correct |
12 |
Correct |
2 ms |
1516 KB |
Output is correct |
13 |
Correct |
2 ms |
1516 KB |
Output is correct |
14 |
Correct |
0 ms |
1516 KB |
Output is correct |
15 |
Correct |
3 ms |
1516 KB |
Output is correct |
16 |
Correct |
3 ms |
1516 KB |
Output is correct |
17 |
Correct |
0 ms |
1516 KB |
Output is correct |
18 |
Correct |
3 ms |
1516 KB |
Output is correct |
19 |
Correct |
3 ms |
1516 KB |
Output is correct |
20 |
Correct |
0 ms |
1516 KB |
Output is correct |
21 |
Correct |
4 ms |
1516 KB |
Output is correct |
22 |
Correct |
4 ms |
1516 KB |
Output is correct |
23 |
Correct |
4 ms |
1516 KB |
Output is correct |
24 |
Correct |
4 ms |
1516 KB |
Output is correct |
25 |
Correct |
0 ms |
1516 KB |
Output is correct |
26 |
Correct |
4 ms |
1516 KB |
Output is correct |
27 |
Correct |
5 ms |
1516 KB |
Output is correct |
28 |
Correct |
5 ms |
1516 KB |
Output is correct |
29 |
Correct |
5 ms |
1516 KB |
Output is correct |
30 |
Correct |
5 ms |
1516 KB |
Output is correct |
31 |
Correct |
5 ms |
1516 KB |
Output is correct |
32 |
Correct |
5 ms |
1516 KB |
Output is correct |
33 |
Correct |
5 ms |
1516 KB |
Output is correct |
34 |
Correct |
5 ms |
1516 KB |
Output is correct |
35 |
Correct |
5 ms |
1516 KB |
Output is correct |
36 |
Correct |
5 ms |
1516 KB |
Output is correct |
37 |
Correct |
5 ms |
1516 KB |
Output is correct |
38 |
Correct |
3 ms |
1516 KB |
Output is correct |
39 |
Correct |
6 ms |
1516 KB |
Output is correct |
40 |
Correct |
6 ms |
1516 KB |
Output is correct |
41 |
Correct |
6 ms |
1516 KB |
Output is correct |
42 |
Correct |
6 ms |
1516 KB |
Output is correct |
43 |
Correct |
6 ms |
1516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
1516 KB |
Output is correct |
2 |
Correct |
279 ms |
1516 KB |
Output is correct |
3 |
Correct |
493 ms |
1516 KB |
Output is correct |
4 |
Correct |
261 ms |
1516 KB |
Output is correct |
5 |
Correct |
429 ms |
1516 KB |
Output is correct |
6 |
Correct |
326 ms |
1516 KB |
Output is correct |
7 |
Correct |
249 ms |
1516 KB |
Output is correct |
8 |
Correct |
259 ms |
1516 KB |
Output is correct |
9 |
Correct |
271 ms |
1516 KB |
Output is correct |
10 |
Correct |
267 ms |
1516 KB |
Output is correct |
11 |
Correct |
461 ms |
1516 KB |
Output is correct |
12 |
Correct |
252 ms |
1516 KB |
Output is correct |
13 |
Correct |
398 ms |
1516 KB |
Output is correct |
14 |
Correct |
308 ms |
1516 KB |
Output is correct |
15 |
Correct |
235 ms |
1516 KB |
Output is correct |
16 |
Correct |
248 ms |
1516 KB |
Output is correct |
17 |
Correct |
250 ms |
1516 KB |
Output is correct |
18 |
Correct |
247 ms |
1516 KB |
Output is correct |
19 |
Correct |
412 ms |
1516 KB |
Output is correct |
20 |
Correct |
228 ms |
1516 KB |
Output is correct |
21 |
Correct |
357 ms |
1516 KB |
Output is correct |
22 |
Correct |
282 ms |
1516 KB |
Output is correct |
23 |
Correct |
219 ms |
1516 KB |
Output is correct |
24 |
Correct |
222 ms |
1516 KB |
Output is correct |
25 |
Correct |
208 ms |
1516 KB |
Output is correct |
26 |
Correct |
209 ms |
1516 KB |
Output is correct |
27 |
Correct |
338 ms |
1516 KB |
Output is correct |
28 |
Correct |
194 ms |
1516 KB |
Output is correct |
29 |
Correct |
308 ms |
1516 KB |
Output is correct |
30 |
Correct |
242 ms |
1516 KB |
Output is correct |
31 |
Correct |
184 ms |
1516 KB |
Output is correct |
32 |
Correct |
191 ms |
1516 KB |
Output is correct |
33 |
Correct |
164 ms |
1516 KB |
Output is correct |
34 |
Correct |
163 ms |
1516 KB |
Output is correct |
35 |
Correct |
245 ms |
1516 KB |
Output is correct |
36 |
Correct |
152 ms |
1516 KB |
Output is correct |
37 |
Correct |
236 ms |
1516 KB |
Output is correct |
38 |
Correct |
186 ms |
1516 KB |
Output is correct |
39 |
Correct |
144 ms |
1516 KB |
Output is correct |
40 |
Correct |
148 ms |
1516 KB |
Output is correct |
41 |
Correct |
310 ms |
1516 KB |
Output is correct |
42 |
Correct |
311 ms |
1516 KB |
Output is correct |
43 |
Correct |
318 ms |
1516 KB |
Output is correct |
44 |
Correct |
315 ms |
1516 KB |
Output is correct |
45 |
Correct |
318 ms |
1516 KB |
Output is correct |
46 |
Correct |
311 ms |
1516 KB |
Output is correct |
47 |
Correct |
319 ms |
1516 KB |
Output is correct |
48 |
Correct |
317 ms |
1516 KB |
Output is correct |
49 |
Correct |
325 ms |
1516 KB |
Output is correct |
50 |
Correct |
318 ms |
1516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
334 ms |
1516 KB |
Output is correct |
2 |
Correct |
313 ms |
1516 KB |
Output is correct |
3 |
Correct |
286 ms |
1516 KB |
Output is correct |
4 |
Correct |
233 ms |
1516 KB |
Output is correct |
5 |
Correct |
166 ms |
1516 KB |
Output is correct |
6 |
Correct |
171 ms |
1516 KB |
Output is correct |
7 |
Correct |
173 ms |
1516 KB |
Output is correct |
8 |
Correct |
169 ms |
1516 KB |
Output is correct |
9 |
Correct |
168 ms |
1516 KB |
Output is correct |
10 |
Correct |
178 ms |
1516 KB |
Output is correct |
11 |
Correct |
171 ms |
1516 KB |
Output is correct |
12 |
Correct |
97 ms |
1516 KB |
Output is correct |
13 |
Correct |
98 ms |
1516 KB |
Output is correct |
14 |
Correct |
99 ms |
1516 KB |
Output is correct |
15 |
Correct |
97 ms |
1516 KB |
Output is correct |
16 |
Correct |
98 ms |
1516 KB |
Output is correct |
17 |
Correct |
99 ms |
1516 KB |
Output is correct |
18 |
Correct |
98 ms |
1516 KB |
Output is correct |
19 |
Correct |
21 ms |
1516 KB |
Output is correct |
20 |
Correct |
24 ms |
1516 KB |
Output is correct |
21 |
Correct |
23 ms |
1516 KB |
Output is correct |
22 |
Correct |
22 ms |
1516 KB |
Output is correct |
23 |
Correct |
23 ms |
1516 KB |
Output is correct |
24 |
Correct |
22 ms |
1516 KB |
Output is correct |
25 |
Correct |
23 ms |
1516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
330 ms |
1516 KB |
Output is correct |
2 |
Correct |
326 ms |
1516 KB |
Output is correct |
3 |
Correct |
331 ms |
1516 KB |
Output is correct |
4 |
Correct |
323 ms |
1516 KB |
Output is correct |
5 |
Correct |
249 ms |
1516 KB |
Output is correct |
6 |
Correct |
235 ms |
1516 KB |
Output is correct |
7 |
Correct |
380 ms |
1516 KB |
Output is correct |
8 |
Correct |
235 ms |
1516 KB |
Output is correct |
9 |
Correct |
205 ms |
1516 KB |
Output is correct |
10 |
Correct |
577 ms |
1516 KB |
Output is correct |
11 |
Correct |
308 ms |
1516 KB |
Output is correct |
12 |
Correct |
318 ms |
1516 KB |
Output is correct |
13 |
Correct |
306 ms |
1516 KB |
Output is correct |
14 |
Correct |
306 ms |
1516 KB |
Output is correct |
15 |
Correct |
238 ms |
1516 KB |
Output is correct |
16 |
Correct |
222 ms |
1516 KB |
Output is correct |
17 |
Correct |
364 ms |
1516 KB |
Output is correct |
18 |
Correct |
224 ms |
1516 KB |
Output is correct |
19 |
Correct |
196 ms |
1516 KB |
Output is correct |
20 |
Correct |
555 ms |
1516 KB |
Output is correct |
21 |
Correct |
283 ms |
1516 KB |
Output is correct |
22 |
Correct |
280 ms |
1516 KB |
Output is correct |
23 |
Correct |
286 ms |
1516 KB |
Output is correct |
24 |
Correct |
283 ms |
1516 KB |
Output is correct |
25 |
Correct |
214 ms |
1516 KB |
Output is correct |
26 |
Correct |
206 ms |
1516 KB |
Output is correct |
27 |
Correct |
328 ms |
1516 KB |
Output is correct |
28 |
Correct |
205 ms |
1516 KB |
Output is correct |
29 |
Correct |
175 ms |
1516 KB |
Output is correct |
30 |
Correct |
509 ms |
1516 KB |
Output is correct |
31 |
Correct |
240 ms |
1516 KB |
Output is correct |
32 |
Correct |
238 ms |
1516 KB |
Output is correct |
33 |
Correct |
232 ms |
1516 KB |
Output is correct |
34 |
Correct |
240 ms |
1516 KB |
Output is correct |
35 |
Correct |
185 ms |
1516 KB |
Output is correct |
36 |
Correct |
177 ms |
1516 KB |
Output is correct |
37 |
Correct |
283 ms |
1516 KB |
Output is correct |
38 |
Correct |
176 ms |
1516 KB |
Output is correct |
39 |
Correct |
152 ms |
1516 KB |
Output is correct |
40 |
Correct |
436 ms |
1516 KB |
Output is correct |