Submission #169829


Source Code Expand

Copy
import itertools
n = int(raw_input())
a = []
b = [] 
c = []
ans = 0
ans = float(ans)
for i in range(n):
    tmp = int(raw_input())
    a.append(tmp)
    b.append(0)

c = list(itertools.permutations(a))

tmp = 1.0
for j in range(1, n + 1):
    tmp = tmp * j

tmp1 = int(tmp)
for i in range(tmp1):
    for l in range(n):
        for j in range((l + 1), n):
            if c[i][l] % c[i][j] == 0:
                b[j] += 1
    for k in range(n):
        if b[k] % 2 == 0:
            ans += 1
    for m in range(n):
        b[m] = 0

tmp = 1.0
for j in range(1, n + 1):
    tmp = tmp * j

tmp = tmp * n
print ans * n / tmp

Submission Info

Submission Time
Task C - コイン
User kametaso
Language Python (2.7.3)
Score 0
Code Size 656 Byte
Status
Exec Time 2129 ms
Memory 727600 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 0 / 99 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Subtask2 0 / 1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_20.txt
Case Name Status Exec Time Memory
sample_01.txt 58 ms 3380 KB
sample_02.txt 47 ms 3380 KB
sample_03.txt 47 ms 3380 KB
subtask1_01.txt 46 ms 3384 KB
subtask1_02.txt 55 ms 3380 KB
subtask1_03.txt 47 ms 3376 KB
subtask1_04.txt 804 ms 9880 KB
subtask1_05.txt 822 ms 9828 KB
subtask1_06.txt 134 ms 4020 KB
subtask1_07.txt 786 ms 9820 KB
subtask1_08.txt 58 ms 3376 KB
subtask1_09.txt 51 ms 3356 KB
subtask1_10.txt 837 ms 9824 KB
subtask1_11.txt 54 ms 3372 KB
subtask1_12.txt 852 ms 9820 KB
subtask1_13.txt 47 ms 3460 KB
subtask1_14.txt 135 ms 4004 KB
subtask1_15.txt 861 ms 9820 KB
subtask1_16.txt 791 ms 9820 KB
subtask1_17.txt 864 ms 9828 KB
subtask1_18.txt 871 ms 9820 KB
subtask1_19.txt 864 ms 9828 KB
subtask1_20.txt 836 ms 9828 KB
subtask2_01.txt 2113 ms 655716 KB
subtask2_02.txt 2129 ms 678240 KB
subtask2_03.txt 2118 ms 727600 KB
subtask2_04.txt 2114 ms 700712 KB
subtask2_05.txt 2103 ms 718256 KB
subtask2_06.txt 2114 ms 716324 KB
subtask2_07.txt 2106 ms 700712 KB
subtask2_08.txt 2114 ms 713512 KB
subtask2_09.txt 2111 ms 708652 KB
subtask2_10.txt 2113 ms 715188 KB
subtask2_11.txt 2110 ms 707500 KB
subtask2_12.txt 2110 ms 702124 KB
subtask2_13.txt 2111 ms 708016 KB
subtask2_14.txt 2108 ms 708648 KB
subtask2_15.txt 2123 ms 709292 KB
subtask2_16.txt 2117 ms 715304 KB
subtask2_17.txt 2110 ms 713512 KB
subtask2_18.txt 2108 ms 706424 KB
subtask2_19.txt 2121 ms 715184 KB
subtask2_20.txt 2107 ms 708912 KB