#include <iostream>
#include <utility>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair <ll, ll> pll;
#define x first
#define y second
#define mp make_pair
int n, q;
pll a[200005];
ll operator *(pll x, pll y){
return (x.x * y.y - x.y * y.x);
}
ld duljina(pll x, pll y){
ld ret = sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y));
return ret;
}
ll crossprod(pll x1, pll y1, pll x2, pll y2){
ll ret = (x1 * y2 - y1 * x2);
return ret;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0 ; i < n ; ++i){
cin >> a[i].x >> a[i].y;
}
cin >> q;
for(int i = n ; i < 2 * n ; ++i){
a[i] = a[i - n];
}
int j = 0;
ld sad = 0, sol = 0;
for(int i = 0 ; i < n ; ++i){
if(i == j){
j++;
sad += duljina(a[i], a[j]);
}
while(crossprod(a[i], a[i + 1], a[j], a[j + 1]) > 0 && j < 2 * n){
sad += duljina(a[j], a[j + 1]);
j++;
}
sol = max(sol, sad);
sad -= duljina(a[i], a[i + 1]);
}
cout << fixed << setprecision(10) << sol << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
1st numbers differ - expected: '34724.8554753593', found: '18909.8626860653', error = '0.4554372530' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
1st numbers differ - expected: '34724.8554753593', found: '18909.8626860653', error = '0.4554372530' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
1st numbers differ - expected: '32934.3604541195', found: '17194.3127500315', error = '0.4779217658' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
476 KB |
1st numbers differ - expected: '1042655967.3918291330', found: '599870579.3663578033', error = '0.4246706506' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
1st numbers differ - expected: '34724.8554753593', found: '18909.8626860653', error = '0.4554372530' |
2 |
Halted |
0 ms |
0 KB |
- |