...
parent
3367825272
commit
f96286b520
4
Makefile
4
Makefile
|
@ -5,12 +5,12 @@ SHELL=bash
|
||||||
|
|
||||||
run:
|
run:
|
||||||
make $$P && { head $$S.in | cut -c-80 ; echo ; \
|
make $$P && { head $$S.in | cut -c-80 ; echo ; \
|
||||||
time ./$$P < $$S.in ; echo \
|
time ./$$P < $$S.in ; echo ; \
|
||||||
cat $$S.ans ; echo ; \
|
cat $$S.ans ; echo ; \
|
||||||
diff -Naur <( ./$$P < $$S.in ) $$S.ans ; }
|
diff -Naur <( ./$$P < $$S.in ) $$S.ans ; }
|
||||||
|
|
||||||
run_py:
|
run_py:
|
||||||
head $$S.in | cut -c-80 ; echo ; \
|
head $$S.in | cut -c-80 ; echo ; \
|
||||||
time python $$P.py < $$S.in ; echo \
|
time python $$P.py < $$S.in ; echo ; \
|
||||||
cat $$S.ans ; echo ; \
|
cat $$S.ans ; echo ; \
|
||||||
diff -Naur <( python $$P.py < $$S.in ) $$S.ans
|
diff -Naur <( python $$P.py < $$S.in ) $$S.ans
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
from __future__ import print_function
|
||||||
|
import sys, itertools as it
|
||||||
|
|
||||||
|
n = int(sys.stdin.readline())
|
||||||
|
|
||||||
|
def mul(a, b):
|
||||||
|
x,y = a; z,w = b
|
||||||
|
return x*z + y*w
|
||||||
|
def add(a, b):
|
||||||
|
x,y = a; z,w = b
|
||||||
|
return (x+z, y+w)
|
||||||
|
def sub(a, b):
|
||||||
|
x,y = a; z,w = b
|
||||||
|
return (x-z, y-w)
|
||||||
|
|
||||||
|
def on_line(a, b, c):
|
||||||
|
d = sub(c,a)
|
||||||
|
e = sub(c,b)
|
||||||
|
return d[0]*e[1] == d[1]*e[0]
|
||||||
|
|
||||||
|
if n >= 5:
|
||||||
|
line1 = line2 = None
|
||||||
|
P = [ map(int, line.split()) for line in sys.stdin ]
|
||||||
|
for com in it.combinations(P[:5], 3):
|
||||||
|
a,b,c = com
|
||||||
|
if on_line(*com):
|
||||||
|
line1 = [a,b]; break
|
||||||
|
else:
|
||||||
|
print("failure")
|
||||||
|
sys.exit(0)
|
||||||
|
Q = []
|
||||||
|
for p in P:
|
||||||
|
if not on_line(p, *line1):
|
||||||
|
if len(Q) < 2: Q.append(p)
|
||||||
|
if len(Q) > 1:
|
||||||
|
if line2 is None:
|
||||||
|
line2 = Q[:]
|
||||||
|
elif not on_line(p, *line2):
|
||||||
|
print("failure")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
print("success")
|
Loading…
Reference in New Issue