Submission #1857274
Source Code Expand
import numpy as np import math import sys v = [] for s in range(6): vv = [float(a) for a in raw_input().split()] v.append(vv + [0]) verts = np.array(v) v1 = verts[1] - verts[0] v2 = verts[2] - verts[1] v3 = verts[3] - verts[2] v4 = verts[4] - verts[3] v5 = verts[5] - verts[4] v6 = verts[0] - verts[5] def is_parallel(a, b): if a[0] == 0 and a[1] == 0: return False if b[0] == 0 and b[1] == 0: return False if a[0] != 0: if b[0] != 0: return a[1] / a[0] == b[1] / b[0] else: return False else: if b[0] != 0: return False else: return True if not is_parallel(v1, v4): print -1 sys.exit(0) if not is_parallel(v2, v5): print -1 sys.exit(0) if not is_parallel(v3, v6): print -1 sys.exit(0) n1 = np.array([v1[1], -v1[0], 0]) n2 = np.array([v2[1], -v2[0], 0]) n3 = np.array([v3[1], -v3[0], 0]) r12 = n1.dot(n2) r23 = n2.dot(n3) r13 = n1.dot(n3) if r12 == 0 or r23 == 0 or r13 == 0: print -1 sys.exit(0) n1[2] = math.sqrt(-r12 * r13 / r23) n2[2] = math.sqrt(-r12 * r23 / r13) n3[2] = math.sqrt(-r13 * r23 / r12) n1 = n1 / np.linalg.norm(n1) n2 = n2 / np.linalg.norm(n2) n3 = n3 / np.linalg.norm(n3) d1 = np.abs(n1.dot(verts[0]) - n1.dot(verts[3])) d2 = np.abs(n2.dot(verts[1]) - n2.dot(verts[4])) d3 = np.abs(n3.dot(verts[2]) - n3.dot(verts[5])) V1= d1 * d2 * d3 n1 = np.array([v1[1], -v1[0], 0]) n2 = np.array([v2[1], -v2[0], 0]) n3 = np.array([v3[1], -v3[0], 0]) r12 = n1.dot(n2) r23 = n2.dot(n3) r13 = n1.dot(n3) #print r12, r23, r13 n1[2] = -math.sqrt(-r12 * r13 / r23) n2[2] = -math.sqrt(-r12 * r23 / r13) n3[2] = -math.sqrt(-r13 * r23 / r12) n1 = n1 / np.linalg.norm(n1) n2 = n2 / np.linalg.norm(n2) n3 = n3 / np.linalg.norm(n3) d1 = np.abs(n1.dot(verts[0]) - n1.dot(verts[3])) d2 = np.abs(n2.dot(verts[1]) - n2.dot(verts[4])) d3 = np.abs(n3.dot(verts[2]) - n3.dot(verts[5])) V2= d1 * d2 * d3 print min(V1, V2)
Submission Info
Submission Time | |
---|---|
Task | E - Hexagon |
User | yocchiman |
Language | Python (2.7.6) |
Score | 0 |
Code Size | 2053 Byte |
Status | RE |
Exec Time | 92 ms |
Memory | 10536 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s0.txt, s1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 040.txt, 041.txt, 042.txt, 043.txt, s0.txt, s1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 90 ms | 10536 KB |
001.txt | AC | 90 ms | 10536 KB |
002.txt | AC | 90 ms | 10536 KB |
003.txt | AC | 90 ms | 10536 KB |
004.txt | AC | 90 ms | 10536 KB |
005.txt | AC | 90 ms | 10536 KB |
006.txt | AC | 90 ms | 10536 KB |
007.txt | AC | 90 ms | 10536 KB |
008.txt | AC | 90 ms | 10536 KB |
009.txt | AC | 90 ms | 10536 KB |
010.txt | AC | 90 ms | 10536 KB |
011.txt | AC | 90 ms | 10536 KB |
012.txt | AC | 90 ms | 10536 KB |
013.txt | AC | 90 ms | 10536 KB |
014.txt | AC | 90 ms | 10536 KB |
015.txt | AC | 90 ms | 10536 KB |
016.txt | AC | 91 ms | 10536 KB |
017.txt | AC | 90 ms | 10536 KB |
018.txt | AC | 90 ms | 10536 KB |
019.txt | AC | 90 ms | 10536 KB |
020.txt | RE | 90 ms | 10536 KB |
021.txt | AC | 90 ms | 10536 KB |
022.txt | RE | 89 ms | 10536 KB |
023.txt | AC | 91 ms | 10536 KB |
024.txt | RE | 91 ms | 10536 KB |
025.txt | AC | 90 ms | 10536 KB |
026.txt | AC | 90 ms | 10536 KB |
027.txt | RE | 90 ms | 10536 KB |
028.txt | AC | 90 ms | 10536 KB |
029.txt | RE | 90 ms | 10536 KB |
030.txt | AC | 90 ms | 10536 KB |
040.txt | AC | 90 ms | 10536 KB |
041.txt | AC | 92 ms | 10536 KB |
042.txt | RE | 90 ms | 10536 KB |
043.txt | AC | 92 ms | 10536 KB |
s0.txt | AC | 92 ms | 10536 KB |
s1.txt | AC | 90 ms | 10536 KB |