Skip to content

Commit d7969ad

Browse files
committed
Finish question C
1 parent 78accf6 commit d7969ad

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
"""
22
https://atcoder.jp/contests/abc266/tasks/abc266_c
3-
"""
3+
"""
4+
from typing import List, Tuple
5+
6+
7+
class Solution:
8+
@staticmethod
9+
def is_valid(x, y, z):
10+
x1 = y[0] - x[0]
11+
y1 = y[1] - x[1]
12+
x2 = z[0] - x[0]
13+
y2 = z[1] - x[1]
14+
15+
if x1 * y2 - x2 * y1 > 0:
16+
return True
17+
else:
18+
return False
19+
20+
@staticmethod
21+
def check_convex_quadrilateral(a_b_c_d: List[Tuple[int]]) -> str:
22+
a, b, c, d = a_b_c_d
23+
24+
if Solution.is_valid(a, b, d) \
25+
and Solution.is_valid(b, c, a) \
26+
and Solution.is_valid(c, d, b) \
27+
and Solution.is_valid(d, a, c):
28+
return 'Yes'
29+
else:
30+
return 'No'
31+
32+
33+
if __name__ == '__main__':
34+
A_B_C_D = [tuple(int(i) for i in input().split()) for i in range(4)]
35+
print(Solution.check_convex_quadrilateral(A_B_C_D))

0 commit comments

Comments
 (0)