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

Code

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

#define LOOP(i,s,e) for (uint64_t i = (s); i < (e); i++)
#define SCAN(...) if (scanf(__VA_ARGS__) == 0) return EXIT_FAILURE

int main() {
    uint64_t n = 0;
    SCAN("%ld", &n);

    int64_t acc = 0;
    int64_t x1, x2, x0, y1, y2, y0;
    SCAN("%ld %ld", &x1, &y1);
    y0 = y1, x0 = x1;
    LOOP(i, 0, n-1){
        SCAN("%ld %ld", &x2, &y2);
        acc += x1*y2 - x2*y1;
        x1 = x2, y1 = y2;
    }
    acc += x1*y0 - x0*y1;


    printf("%ld", abs(acc));

    return EXIT_SUCCESS;
}

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