| Task: | Polygon area |
| Sender: | francden |
| Submission time: | 2025-11-10 16:33:48 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.06 s | details |
| #3 | ACCEPTED | 0.04 s | details |
Code
n = int(input())
last_x,last_y = [int(x) for x in input().split()]
area = 0
first_x,first_y = last_x,last_y
for _ in range (n-1):
curr_x,curr_y = [int(x) for x in input().split()]
area += last_x*curr_y - last_y*curr_x
last_x,last_y = curr_x,curr_y
area += last_x*first_y - last_y*first_x
print(abs(area))
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 100 -7 -19 91 77 100 100 64 60 ... |
| correct output |
|---|
| 43582 |
| user output |
|---|
| 43582 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 1000 365625896 -113418831 278762563 38777445 250367343 -96991975 175866909 -129766978 ... |
| correct output |
|---|
| 4053466653883387139 |
| user output |
|---|
| 4053466653883387139 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 4 -1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000 1000000000 -1000000000 |
| correct output |
|---|
| 8000000000000000000 |
| user output |
|---|
| 8000000000000000000 |
