Submission #7360

# Submission time Handle Problem Language Result Execution time Memory
7360 2014-08-03T05:15:27 Z netsion 경비원 (GA8_guard) C++
8 / 100
2000 ms 20712 KB
#include <stdio.h>
int data[2240];
int map1[2240][2240];
int now,n;
int ndata[2240];
int tot=0;
int check[2240];
void aa(int cnt,int la)
{
    int i,j;
    if(cnt==now)
    {
        for(i=0; i<cnt; i++)
        {
            for(j=i; j<cnt; j++)
            {
                if(i==j) continue;
                if(map1[ndata[i]][ndata[j]]!=1) return;
            }
        }
        tot++;
        return;
    }
    for(i=la; i<=n; i++)
    {
        if(check[i]==0)
        {
            check[i]=1;
            ndata[cnt]=i;
            aa(cnt+1,i);
            check[i]=0;
        }
    }
}
int main()
{
    int i,j,a,b,cc=0,dump=0;
    scanf("%d\n",&n);
    for(i=1; i<=n; i++)
    {
        scanf("%d ",&data[i]);
    }
    /** 유클리드 시작 **/
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=n; j++)
        {
            if(i==j) continue;
            cc=0;
            a=data[i];
            b=data[j];
            do
            {
                if(b>a)
                {
                    dump=a;
                    a=b;
                    b=dump;
                }
                if(b==0)
                {
                    if(a==1) cc=1;
                    else cc=0;
                    break;
                }
                a%=b;
            }
            while(1);
            if(cc==1)
            {
                map1[i][j]=1;
            }
        }
    }
    /** 유클리드 끝 **/
    for(i=2; i<=n; i++)
    {
        now=i;
        aa(0,1);
    }
    printf("%d",tot);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 20712 KB Output is correct
2 Correct 0 ms 20712 KB Output is correct
3 Correct 0 ms 20712 KB Output is correct
4 Correct 0 ms 20712 KB Output is correct
5 Correct 0 ms 20712 KB Output is correct
6 Correct 0 ms 20712 KB Output is correct
7 Correct 0 ms 20712 KB Output is correct
8 Correct 0 ms 20712 KB Output is correct
9 Correct 4 ms 20712 KB Output is correct
10 Correct 4 ms 20712 KB Output is correct
11 Correct 84 ms 20712 KB Output is correct
12 Correct 80 ms 20712 KB Output is correct
13 Correct 0 ms 20712 KB Output is correct
14 Correct 0 ms 20712 KB Output is correct
15 Correct 0 ms 20712 KB Output is correct
16 Correct 0 ms 20712 KB Output is correct
17 Correct 0 ms 20712 KB Output is correct
18 Correct 0 ms 20712 KB Output is correct
19 Correct 0 ms 20712 KB Output is correct
20 Correct 0 ms 20712 KB Output is correct
21 Correct 0 ms 20712 KB Output is correct
22 Correct 0 ms 20712 KB Output is correct
23 Correct 0 ms 20712 KB Output is correct
24 Correct 0 ms 20712 KB Output is correct
25 Correct 4 ms 20712 KB Output is correct
26 Correct 0 ms 20712 KB Output is correct
27 Correct 8 ms 20712 KB Output is correct
28 Correct 84 ms 20712 KB Output is correct
29 Correct 100 ms 20712 KB Output is correct
30 Correct 192 ms 20712 KB Output is correct
31 Correct 0 ms 20712 KB Output is correct
32 Correct 0 ms 20712 KB Output is correct
33 Correct 0 ms 20712 KB Output is correct
34 Correct 0 ms 20712 KB Output is correct
35 Correct 4 ms 20712 KB Output is correct
36 Correct 84 ms 20712 KB Output is correct
37 Correct 0 ms 20712 KB Output is correct
38 Correct 0 ms 20712 KB Output is correct
39 Correct 0 ms 20712 KB Output is correct
40 Correct 0 ms 20712 KB Output is correct
41 Correct 8 ms 20712 KB Output is correct
42 Correct 152 ms 20712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 20712 KB Output is correct
2 Correct 0 ms 20712 KB Output is correct
3 Correct 0 ms 20712 KB Output is correct
4 Correct 0 ms 20712 KB Output is correct
5 Correct 0 ms 20712 KB Output is correct
6 Correct 0 ms 20712 KB Output is correct
7 Correct 0 ms 20712 KB Output is correct
8 Correct 0 ms 20712 KB Output is correct
9 Correct 0 ms 20712 KB Output is correct
10 Correct 0 ms 20712 KB Output is correct
11 Correct 0 ms 20712 KB Output is correct
12 Correct 0 ms 20712 KB Output is correct
13 Correct 0 ms 20712 KB Output is correct
14 Correct 0 ms 20712 KB Output is correct
15 Correct 4 ms 20712 KB Output is correct
16 Correct 8 ms 20712 KB Output is correct
17 Correct 16 ms 20712 KB Output is correct
18 Correct 44 ms 20712 KB Output is correct
19 Correct 96 ms 20712 KB Output is correct
20 Correct 196 ms 20712 KB Output is correct
21 Correct 408 ms 20712 KB Output is correct
22 Correct 860 ms 20712 KB Output is correct
23 Correct 1772 ms 20712 KB Output is correct
24 Execution timed out 2000 ms 20708 KB Program timed out
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 20708 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 20708 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 20708 KB Program timed out
2 Halted 0 ms 0 KB -