Submission details
Task:Point in Polygon
Sender:aalto26jm_027
Submission time:2026-11-09 17:17:59 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.01 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails

Code

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
 
using namespace std;
 
int main() {
    int n;
    cin >> n;

    vector<pair<int, int>> coords(n+1);

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

    coords[n] = coords[0];

    long long area = 0;

    for(int i = 0; i < n; i++){
        area += 1ll * coords[i].first * coords[i+1].second - 1ll * coords[i].second * coords[i+1].first;
    }

    cout << abs(area) << endl;
    
}

Test details

Test 1

Verdict:

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

correct output
INSIDE
OUTSIDE
INSIDE
INSIDE
INSIDE
...

user output
558

Feedback: Output is shorter than expected

Test 2

Verdict:

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

correct output
OUTSIDE
OUTSIDE
INSIDE
OUTSIDE
OUTSIDE
...

user output
2964980592166222056

Feedback: Output is shorter than expected

Test 3

Verdict:

input
4 1
1 5
5 5
5 1
1 1
...

correct output
INSIDE

user output
0

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

Test 4

Verdict:

input
4 1
1 5
5 5
5 1
1 1
...

correct output
OUTSIDE

user output
0

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

Test 5

Verdict:

input
4 1
1 100
2 50
1 20
0 50
...

correct output
INSIDE

user output
98

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "98"

Test 6

Verdict:

input
8 1
0 0
0 2
1 1
2 2
...

correct output
INSIDE

user output
4

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "4"

Test 7

Verdict:

input
4 4
0 0
3 0
3 4
0 4
...

correct output
INSIDE
BOUNDARY
OUTSIDE
BOUNDARY

user output
0

Feedback: Output is shorter than expected

Test 8

Verdict:

input
6 1
0 0
0 2
3 1
2 2
...

correct output
INSIDE

user output
12

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "12"

Test 9

Verdict:

input
3 1
0 0
1 1000000000
-3 0
1 1

correct output
OUTSIDE

user output
999999996

Feedback: Incorrect character on line 1 col 1: expected "OUTSIDE", got "999999996"

Test 10

Verdict:

input
3 1
-100000 0
-1000000000 -999999999
1000000000 1000000000
0 0

correct output
OUTSIDE

user output
999900001000100000

Feedback: Incorrect character on line 1 col 1: expected "OUTSIDE", got "999900001000..."

Test 11

Verdict:

input
3 1
-100000 0
-999999999 -1000000000
1000 1000
0 0

correct output
INSIDE

user output
999900000000000999

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "999900000000..."

Test 12

Verdict:

input
4 1
-4 1
-6 1
-6 -1
-4 -1
...

correct output
INSIDE

user output
4

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "4"

Test 13

Verdict:

input
3 1
0 10
0 -10
10 0
1 0

correct output
INSIDE

user output
90

Feedback: Incorrect character on line 1 col 1: expected "INSIDE", got "90"

Test 14

Verdict:

input
3 1000
-536621709 -536621709
955833081 955833081
-1 1
-439278425 -439278425
...

correct output
BOUNDARY
BOUNDARY
BOUNDARY
BOUNDARY
BOUNDARY
...

user output
1714499562379284962

Feedback: Output is shorter than expected