From 5cfeec0f11dbcff922fe5b1a1a17bccf4812852e Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Thu, 3 Aug 2017 03:06:23 +0700 Subject: [others] Move other/colorec.* to mHoang and add other/{defrac,lang}.py --- others/other/colorec.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100755 others/other/colorec.py (limited to 'others/other/colorec.py') diff --git a/others/other/colorec.py b/others/other/colorec.py deleted file mode 100755 index d55ac7f..0000000 --- a/others/other/colorec.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -from itertools import combinations - -COLORS = {1, 2, 3, 4} - -with open('COLOREC.INP') as f: - f.readline() - color, exes, eyes, count = {}, {}, {}, 0 - for line in f: - x, y, c = map(int, line.split()) - color[x, y] = c - exes.setdefault(y, []) - exes[y].append(x) - eyes.setdefault(x, []) - eyes[x].append(y) - -for v in eyes.values(): v.sort() -for y0, l in exes.items(): - for x0, x1 in combinations(l, 2): - s = COLORS - {color[x0, y0], color[x1, y0]} - if len(s) > 2: continue - for y1 in eyes[x0][y0:]: - try: - count += not s - {color[x0, y1], color[x1, y1]} - except: - continue - -with open('COLOREC.OUT', 'w') as f: print(count, file=f) -- cgit 1.4.1