| Task: | Polygon area |
| Sender: | aalto26jm_005 |
| Submission time: | 2026-11-09 16:54:27 +0200 |
| Language: | C++ (C++23) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.01 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
Code
#include <iostream>
#include <vector>
int main(int argc, char** argv) {
int n;
std::cin >> n;
std::vector<std::pair<long, long>> 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 long sum = 0;
for (int i=0; i<n-1; i++) {
long long m = (points[i].first - points[i+1].second) * (points[i].second + points[i+1].first);
//if (m < 0) m = m * -1;
sum += m;
}
if (sum < 0) sum = sum * -1;
area = sum / 2;
std::cout << area << std::endl;
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 100 -7 -19 91 77 100 100 64 60 ... |
| correct output |
|---|
| 43582 |
| user output |
|---|
| 32577 |
Feedback: Incorrect character on line 1 col 1: expected "43582", got "32577"
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1000 365625896 -113418831 278762563 38777445 250367343 -96991975 175866909 -129766978 ... |
| correct output |
|---|
| 4053466653883387139 |
| user output |
|---|
| 2.06307e+18 |
Feedback: Incorrect character on line 1 col 1: expected "405346665388...", got "2.06307e+18"
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 4 -1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000 1000000000 -1000000000 |
| correct output |
|---|
| 8000000000000000000 |
| user output |
|---|
| 2e+18 |
Feedback: Incorrect character on line 1 col 1: expected "800000000000...", got "2e+18"
