# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
5193 | ainta | 초록색 삼각형 (YDX13_green) | C++98 | 160 ms | 1136 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma warning(disable:4996)
#include<stdio.h>
#include<algorithm>
using namespace std;
struct point{
int x, y;
bool operator <(const point &p)const{
return x != p.x ? x < p.x : y < p.y;
}
}w[2010];
struct point2{
long long x, y;
bool operator <(const point2 &p)const{
return y*p.x < p.y*x;
}
}P[2010];
int n;
long double res, S, S2, T;
int main(){
scanf("%d", &n);
int i, j;
for (i = 0; i < n; i++){
scanf("%d%d", &w[i].x, &w[i].y);
}
if (n <= 2){
printf("0\n");
return 0;
}
sort(w, w + n);
for (i = 2; i < n; i++){
for (j = 0; j < i; j++)P[j].x = w[j].x - w[i].x, P[j].y = w[j].y - w[i].y;
sort(P, P + i);
S = 0, S2 = 0;
for (j = 0; j < i - 1; j++){
S += P[j].y, S2 += P[j].x;
res += S2*P[j + 1].y- S*P[j + 1].x;
}
}
T = n;
T = T*(T - 1)*(T - 2) / 3;
res /= T;
printf("%.12llf\n", res);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |