Submission details
Task:Polygon area
Sender:kookinnam
Submission time:2025-11-10 16:24:23 +0200
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.04 sdetails
#20.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)
    start = points[0]
    polygon = points[1:]
    total_area = 0
    for i in range(1, len(polygon)):
        total_area += area(start, polygon[i-1], polygon[i])
    print(total_area)

Test details

Test 1

Verdict:

input
100
-7 -19
91 77
100 100
64 60
...

correct output
43582

user output
202606

Feedback: Incorrect character on line 1 col 1: expected "43582", got "202606"

Test 2

Verdict:

input
1000
365625896 -113418831
278762563 38777445
250367343 -96991975
175866909 -129766978
...

correct output
4053466653883387139

user output
125840793804135223713

Feedback: Incorrect character on line 1 col 1: expected "405346665388...", got "125840793804..."

Test 3

Verdict: ACCEPTED

input
4
-1000000000 -1000000000
-1000000000 1000000000
1000000000 1000000000
1000000000 -1000000000

correct output
8000000000000000000

user output
8000000000000000000