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

Code

n = int(input())

def cross_product(a, b):
    return a[0]*b[1] - a[1]*b[0]

tot = 0
x0, y0 = [int(x) for x in input().split()]
x_0, y_0 = x0, y0
for _ in range(n-1):
    x_1, y_1 = [int(x) for x in input().split()]
    tot += x_0*y_1 - x_1*y_0
    x_0, y_0 = x_1, y_1

tot += x_0*y0 - x0*y_0

print(abs(tot))

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