Diff
Not logged in

Differences From Artifact [959cda21c7e42a70]:

To Artifact [a5ea821173c9c755]:


3 // O(N) 3 // O(N) 4 // 4 // 5 // Verified by 5 // Verified by 6 // - SRM 337 Div1 LV3 6 // - SRM 337 Div1 LV3 7 // - SRM 486 Div1 LV3 7 // - SRM 486 Div1 LV3 8 //------------------------------------------------------------- 8 //------------------------------------------------------------- 9 9 10 double outer_prod( pt a, pt b ) | 10 double outer_prod(const CMP& a, const CMP& b) { return imag(conj(a)*b); } 11 { < 12 return (a.real()*b.imag() - b.real()*a.imag())/2; < 13 } < 14 11 15 double area( const vector<pt>& q ) 12 double area( const vector<pt>& q ) 16 { 13 { 17 double a = 0.0; 14 double a = 0.0; 18 15 19 pt o = q[0]; 16 pt o = q[0]; 20 for(int i=1; i+1<q.size(); ++i) 17 for(int i=1; i+1<q.size(); ++i) 21 a += outer_prod(q[i]-o, q[i+1]-o); 18 a += outer_prod(q[i]-o, q[i+1]-o); 22 return abs(a) / 2; 19 return abs(a) / 2; 23 } 20 }