Submission details
Task:Polygon area
Sender:kookinnam
Submission time:2025-11-10 16:32:16 +0200
Language:Python3 (PyPy3)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.07 sdetails
#3ACCEPTED0.04 sdetails

Code

# def area(point1, point2, point3):
#     (x1, y1) = point1
#     (x2, y2) = point2
#     (x3, y3) = point3

#     return abs(x3 * (y1 - y2) + x1 * (y2 - y3) + x2 * (y3 - y1))


if __name__ == "__main__":
    n = int(input())
    points = []
    for i in range(n):
        point = list(map(int, input().split()))
        points.append(point)

    total_area = 0
    for i in range(n):
        j = (i + 1) % n
        total_area += points[i][0] * points[j][1]
        total_area -= points[j][0] * points[i][1]
    print(abs(total_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