Submission #5192

# Submission time Handle Problem Language Result Execution time Memory
5192 2014-02-14T07:21:43 Z ainta 초록색 삼각형 (YDX13_green) C++
0 / 1
160 ms 1136 KB
#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;
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("%.10lf\n", res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1136 KB Output is correct
2 Correct 0 ms 1136 KB Output is correct
3 Correct 0 ms 1136 KB Output is correct
4 Correct 0 ms 1136 KB Output is correct
5 Correct 0 ms 1136 KB Output is correct
6 Correct 0 ms 1136 KB Output is correct
7 Correct 0 ms 1136 KB Output is correct
8 Correct 0 ms 1136 KB Output is correct
9 Correct 0 ms 1136 KB Output is correct
10 Correct 0 ms 1136 KB Output is correct
11 Correct 24 ms 1136 KB Output is correct
12 Correct 52 ms 1136 KB Output is correct
13 Correct 32 ms 1136 KB Output is correct
14 Correct 140 ms 1136 KB Output is correct
15 Correct 12 ms 1136 KB Output is correct
16 Correct 136 ms 1136 KB Output is correct
17 Correct 8 ms 1136 KB Output is correct
18 Correct 20 ms 1136 KB Output is correct
19 Correct 36 ms 1136 KB Output is correct
20 Correct 0 ms 1136 KB Output is correct
21 Correct 156 ms 1136 KB Output is correct
22 Correct 156 ms 1136 KB Output is correct
23 Correct 156 ms 1136 KB Output is correct
24 Correct 156 ms 1136 KB Output is correct
25 Correct 160 ms 1136 KB Output is correct
26 Correct 156 ms 1136 KB Output is correct
27 Correct 156 ms 1136 KB Output is correct
28 Correct 156 ms 1136 KB Output is correct
29 Correct 156 ms 1136 KB Output is correct
30 Correct 156 ms 1136 KB Output is correct
31 Incorrect 0 ms 1136 KB Output isn't correct