Skip to content

Commit

Permalink
Solve Colision in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Jul 18, 2024
1 parent e867dcd commit 06bf083
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
17 changes: 17 additions & 0 deletions solutions/beecrowd/1618/1618.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
n = int(input())

for _ in range(n):
ax, ay, bx, by, cx, cy, dx, dy, rx, ry = map(int, input().split())
if (
rx >= ax
and ry >= ay
and rx <= bx
and ry >= by
and rx <= cx
and ry <= cy
and rx >= dx
and ry <= dy
):
print(1)
else:
print(0)
Binary file added solutions/beecrowd/1618/imgs/colisao.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions solutions/beecrowd/1618/in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
5
3 6 6 6 6 5 3 5 5 4
1 1 7 1 7 7 1 7 4 2
1 4 7 4 7 6 1 6 5 5
6 2 9 2 9 6 6 6 1 7
4 3 9 3 9 5 4 5 10 7
5 changes: 5 additions & 0 deletions solutions/beecrowd/1618/out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0
1
1
0
0
28 changes: 28 additions & 0 deletions solutions/beecrowd/1618/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
https://judge.beecrowd.com/en/problems/view/1618

# Colision

You have been tasked to check if the robot invaded a rectangular area formed by
four cardinal points ($A$, $B$, $C$ and $D$). Will be informed the four cardinal
points of a plan as shown. The area is formed by connecting the four points as
follows $AB$, $BC$, $CD$ and $DA$. The $X$, $Y$ coordinate of the robot will be
informed

<center>
<img src="imgs/colisao.jpg">
</center>

## Input

The input consists of several test cases. The first line is formed by a number
$N$ indicating the total number of test cases. The next $N$ lines consist of 10
integers ($A_x$, $A_y$, $B_x$, $B_y$, $C_x$, $C_y$, $D_x$, $D_y$, $R_X$, $R_Y$)
representing each of the vertices $A$, $B$, $C$ and $D$ and the location $X$,
$Y$ robot. Each value is separated by a blank space.

## Output

The output should print for each test case, the number 1 if the robot is within
the area (considering the edges of the figure as part of the area of the figure)
, and print the number 0 otherwise.

1 change: 1 addition & 0 deletions solutions/beecrowd/1618/tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ad-hoc

0 comments on commit 06bf083

Please sign in to comment.