Submission details
Task:Polygon area
Sender:aalto26jm_011
Submission time:2026-11-09 16:32:10 +0200
Language:C++ (C++20)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails

Code

#include <bits/stdc++.h>

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef long long C;
typedef complex<C> P;
#define X real()
#define Y imag()
#define FAST                                                                   \
    ios::sync_with_stdio(0);                                                   \
    cin.tie(0);

C cross(P a, P b) { return (conj(a) * b).Y; }

int main() {
    FAST;

    int n;
    cin >> n;

    vector<P> p(n + 1);

    for (int i = 0; i < n; i++) {
        C x, y;
        cin >> x >> y;
        p[i] = {x, y};
    }
    p[n] = p[0];

    C result = 0;
    for (int i = 0; i < n; i++)
        result += cross(p[i], p[i + 1]);

    cout << abs(result);
    return 0;
}

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