-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathccc17s3.py
28 lines (23 loc) · 911 Bytes
/
ccc17s3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""CCC '17 S3 - Nailed It!
Canadian Computing Competition: 2017 Stage 1, Junior #5, Senior #3
"""
def output(s, end = False, highlight=False, index=""):
pass
# ************************ MUST REMOVE BEFORE SUMMIT ************************
from ccc import make_io
input, output = make_io(__file__, "tc2")
# ***************************************************************************
wood_cnt = int(input())
wood_lens = [int(p) for p in input().split(" ")]
boards_lens = dict()
for i in range(0, wood_cnt-1):
for j in range(i+1, wood_cnt):
l = wood_lens[i] + wood_lens[j]
if not l in boards_lens:
boards_lens[l] = []
boards_lens[l].append((i, j))
max_fence_len = max([len(v) for (k, v) in boards_lens.items()])
fences = {k:v for (k, v) in boards_lens.items() if len(v) == max_fence_len}
output(boards_lens)
output(fences)
print("%d %d" % (max_fence_len, len(fences)))