제출 #103735

#제출 시각아이디문제언어결과실행 시간메모리
103735ShtefSvjetlost (COI18_svjetlost)C++14
0 / 100
5 ms476 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...