Submission details
Task:Polygon area
Sender:aalto26jm_005
Submission time:2026-11-09 16:51:51 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.01 sdetails
#30.00 sdetails

Compiler report

input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:17:12: warning: unused variable 'area' [-Wunused-variable]
   17 |     double area = 0.0;
      |            ^~~~

Code

#include <iostream>
#include <vector>


int main(int argc, char** argv) {
    int n;
    std::cin >> n;

    std::vector<std::pair<int, int>> points;
    points.reserve(n);
    for (int i=0; i<n; i++) {
        int a, b;
        std::cin >> a >> b;
        points.push_back({a, b});
    }

    double area = 0.0;
    long sum = 0;
    for (int i=0; i<n-1; i++) {
        int m = (points[i].first - points[i+1].second) * (points[i].second + points[i+1].first);
        if (m < 0) m = m * -1;
        sum += m;
    }

    std::cout << sum << std::endl;

    return 0;
}

Test details

Test 1

Verdict:

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

correct output
43582

user output
357406

Feedback: Incorrect character on line 1 col 1: expected "43582", got "357406"

Test 2

Verdict:

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

correct output
4053466653883387139

user output
1103938852929

Feedback: Incorrect character on line 1 col 1: expected "405346665388...", got "1103938852929"

Test 3

Verdict:

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

correct output
8000000000000000000

user output
4954521600

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