Submission details
Task:Polygon area
Sender:tjaa
Submission time:2025-11-10 16:45:30 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;

typedef long long C;
typedef complex<C> P;
#define X real()
#define Y imag()

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

int main () {

    freopen("input.txt", "r", stdin);
    int n;
    cin >> n;

    long long A = 0;

    int x0, y0;
    cin >> x0 >> y0;
    P prev = {x0, y0};
    while(--n) {
        int x, y;
        cin >> x >> y;
        P cur = {x, y};
        A += cross(prev, cur);
        prev = cur;
    }
    A += cross(prev, {x0, y0});

    cout << A << '\n';
    
    return 0;
}

Test details

Test 1

Verdict:

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

correct output
43582

user output
0

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

Test 2

Verdict:

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

correct output
4053466653883387139

user output
0

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

Test 3

Verdict:

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

correct output
8000000000000000000

user output
0

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