Submission #5220

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
52202014-02-18 05:26:46kriii초록색 삼각형 (YDX13_green)C++98
0 / 1
36 ms1148 KiB
#include <stdio.h>
#include <algorithm>
using namespace std;
struct point{long long x,y;} P[2020],Q[2020];
bool cmp1(const point& a, const point& b){return a.y == b.x ? a.x < b.x : a.y < b.y;}
bool cmp2(const point& a, const point& b){return a.x * b.y - a.y * b.x < 0;}
int main()
{
int N;
scanf ("%d",&N);
for (int i=0;i<N;i++){
scanf ("%lld %lld",&P[i].x,&P[i].y);
}
sort(P,P+N,cmp1);
double ans = 0;
for (int i=0;i<N;i++){
int c = 0;
for (int j=i+1;j<N;j++){
Q[c].x = P[j].x - P[i].x;
Q[c].y = P[j].y - P[i].y;
c++;
}
sort(Q,Q+c,cmp2);
long long sx = 0, sy = 0;
for (int j=0;j<c;j++){
ans += Q[j].x * sy - Q[j].y * sx;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...