Submission details
Task:Polygon area
Sender:ariadna.roga
Submission time:2025-11-10 16:29:47 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#30.00 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

struct Point {
    long long x, y;
}; 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    long long area = 0;
    Point ant;
    cin >> ant.x >> ant.y;

    Point first = ant;

    for (int i = 0; i < n-1; ++i) {
        Point act;
        cin >> act.x >> act.y;

        area += ant.x * act.y - act.x * ant.y;
        ant = act;
    }

    area += ant.x * first.y - first.x * ant.y;

    cout << area << endl;
}

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:

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

correct output
8000000000000000000

user output
-8000000000000000000

Feedback: Incorrect character on line 1 col 1: expected "800000000000...", got "-80000000000..."