| Task: | Polygon area |
| Sender: | aalto26jm_005 |
| Submission time: | 2026-11-09 16:53:24 +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 |
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<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;
std::cout << sum << 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 |
|---|
| 65154 |
Feedback: Incorrect character on line 1 col 1: expected "43582", got "65154"
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1000 365625896 -113418831 278762563 38777445 250367343 -96991975 175866909 -129766978 ... |
| correct output |
|---|
| 4053466653883387139 |
| user output |
|---|
| 4126131292267334305 |
Feedback: Incorrect character on line 1 col 2: expected "405346665388...", got "412613129226..."
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 4 -1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000 1000000000 -1000000000 |
| correct output |
|---|
| 8000000000000000000 |
| user output |
|---|
| 4000000000000000000 |
Feedback: Incorrect character on line 1 col 1: expected "800000000000...", got "400000000000..."
