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

Code

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define VI vector<int>
#define AR(x) array<int, x>
#define MX vector<VI >
#define all(x) x.begin(), x.end()
#define IOS cin.tie(0)->sync_with_stdio(0)

using namespace std;

using C = complex<ll>;

int main(){

    int n;
    cin >> n;

    vector<C> p(n);

    for(auto &c : p){
        ll x, y;
        cin >> x >> y;
        c = {x, y};
    }

    ll ans = 0;
    for(int i=0; i<n; i++){
        ans += p[i].real()*p[(i+1)%n].imag()-p[i].imag()*p[(i+1)%n].real();
    }

    cout << abs(ans) << '\n';


    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