CSES - Aalto Competitive Programming 2024 - wk10 - Mon - Results
Submission details
Task:Polygon area
Sender:laluj
Submission time:2024-11-11 16:30:53 +0200
Language:Python3 (CPython3)
Status:READY
Result:
Test results
testverdicttime
#10.02 sdetails
#20.02 sdetails
#30.02 sdetails

Code

import numpy as np


def polygon_area(vertices):
    n = len(vertices)
    area = 0
    for i in range(n):
        j = (i + 1) % n
        area += vertices[i][0] * vertices[j][1] - vertices[i][1] * vertices[j][0]
    return abs(area)

n = int(input())
vertices = [tuple(map(int, input().split())) for _ in range(n)]

print(polygon_area(vertices))

Test details

Test 1

Verdict:

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

correct output
43582

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...

Test 2

Verdict:

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

correct output
4053466653883387139

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...

Test 3

Verdict:

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

correct output
8000000000000000000

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...