Submission #5064727


Source Code Expand

Copy
import itertools


N = int(input())
A = [int(input()) for i in range(N)]
cnt = 0

idx = [i for i in range(3)]
idx_l = [idx for _ in range(N)]
ans = list(itertools.product(*idx_l))
for a in ans:
    first = 0
    second = 0
    third = 0
    if (len(set(a)) == 3):
        for i, v in enumerate(a):
            if v == 0:
                first += A[i]
            elif v == 1:
                second += A[i]
            else:
                third += A[i]
        path = [first, second, third]
        if 2 * max(path) < sum(path):
            cnt += 1
print(cnt)

Submission Info

Submission Time
Task D - Three Colors
User upura
Language Python3 (3.4.3)
Score 0
Code Size 589 Byte
Status
Exec Time 3317 ms
Memory 3064 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 0 / 600 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 3294 ms -1949708 KB
02.txt 3293 ms -1936396 KB
03.txt 3292 ms -1949196 KB
04.txt 3295 ms -1945228 KB
05.txt 3292 ms -1946252 KB
06.txt 3292 ms -1942924 KB
07.txt 3292 ms -1957644 KB
08.txt 3291 ms -1950348 KB
09.txt 3293 ms -1944460 KB
10.txt 3292 ms -1943308 KB
11.txt 3292 ms -1950860 KB
12.txt 3295 ms -1946892 KB
13.txt 3293 ms -1948044 KB
14.txt 3291 ms -1948044 KB
15.txt 3291 ms -1955852 KB
16.txt 3292 ms -1945740 KB
17.txt 3294 ms -1946252 KB
18.txt 3294 ms -1940492 KB
19.txt 3292 ms -1949196 KB
20.txt 3292 ms -1945228 KB
21.txt 17 ms 3064 KB
22.txt 17 ms 3064 KB
23.txt 18 ms 3064 KB
24.txt 17 ms 3064 KB
s1.txt 17 ms 3064 KB
s2.txt 19 ms 3064 KB
s3.txt 3317 ms -1575272 KB