0_0_29473693_6371.cpp: In function 'int cmp(double)':
0_0_29473693_6371.cpp:1:34: error: 'fabs' was not declared in this scope
int cmp(double x){ if(fabs(x) < 1e-8) return 0 ; if(x > 0) return 1 ; return -1 ;} struct point{ double x , y ; int id ; point(){} point(double _x , double _y):x(_x) , y(_y){} friend bool operator == (const point &a , const point &b){ return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0 ; } friend double operator ^ (const point &a , const point &b){ return a.x * b.y - a.y * b.x ; } friend double dist(const point &a , const point &b){ return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ) ; } point operator - (point o){ return point(x - o.x , y - o.y) ; }}; bool cmpless(const point &a , const point &b){ return cmp(a.x - b.x) < 0 || cmp(a.x - b.x == 0) && cmp(a.y - b.y) < 0 ;} vector<point> convex_hull(vector<point> a){ vector<point> src(2 * a.size() + 5) ; sort(a.begin() , a.end() , cmpless) ; a.erase(unique(a.begin() , a.end()) , a.end()) ; int m = 0 ; for(int i = 0 ; i < a.size() ; i++){ while(m > 1 && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2]) ) <= 0) m-- ; src[m++] = a[i] ; } int k = m ; for(int i = a.size() - 2 ; i >= 0 ; i--){ while(m > k && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2])) <= 0) m-- ; src[m++] = a[i] ; } src.resize(m) ; if(a.size() > 1) src.resize(m-1) ; return src ;} int vis[38] ; int main(){ int n , i , t , pcnt , qcnt , p , q ; cin>>t ; while(t--){ cin>>p>>q>>n ; vector<point> lis(n) ; for(i = 0 ; i < n ; i++){ scanf("%lf%lf" , &lis[i].x , &lis[i].y) ; lis[i].id = i ; } vector<point> hull = convex_hull(lis) ; qcnt = hull.size() ; memset(vis , 0 , sizeof(vis)) ; for(i = 0 ; i < hull.size() ; i++) vis[hull[i].id] = 1 ; pcnt = 0 ; for(i = 0 ; i < n ; i++){ if(vis[i] && !vis[(i+1)%n]) pcnt++ ; } qcnt -= pcnt ; cout<< max(0 , q * qcnt - p * pcnt )<< endl ; } return 0 ;}
^
0_0_29473693_6371.cpp: In function 'double dist(const point&, const point&)':
0_0_29473693_6371.cpp:1:604: error: 'sqrt' was not declared in this scope
int cmp(double x){ if(fabs(x) < 1e-8) return 0 ; if(x > 0) return 1 ; return -1 ;} struct point{ double x , y ; int id ; point(){} point(double _x , double _y):x(_x) , y(_y){} friend bool operator == (const point &a , const point &b){ return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0 ; } friend double operator ^ (const point &a , const point &b){ return a.x * b.y - a.y * b.x ; } friend double dist(const point &a , const point &b){ return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ) ; } point operator - (point o){ return point(x - o.x , y - o.y) ; }}; bool cmpless(const point &a , const point &b){ return cmp(a.x - b.x) < 0 || cmp(a.x - b.x == 0) && cmp(a.y - b.y) < 0 ;} vector<point> convex_hull(vector<point> a){ vector<point> src(2 * a.size() + 5) ; sort(a.begin() , a.end() , cmpless) ; a.erase(unique(a.begin() , a.end()) , a.end()) ; int m = 0 ; for(int i = 0 ; i < a.size() ; i++){ while(m > 1 && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2]) ) <= 0) m-- ; src[m++] = a[i] ; } int k = m ; for(int i = a.size() - 2 ; i >= 0 ; i--){ while(m > k && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2])) <= 0) m-- ; src[m++] = a[i] ; } src.resize(m) ; if(a.size() > 1) src.resize(m-1) ; return src ;} int vis[38] ; int main(){ int n , i , t , pcnt , qcnt , p , q ; cin>>t ; while(t--){ cin>>p>>q>>n ; vector<point> lis(n) ; for(i = 0 ; i < n ; i++){ scanf("%lf%lf" , &lis[i].x , &lis[i].y) ; lis[i].id = i ; } vector<point> hull = convex_hull(lis) ; qcnt = hull.size() ; memset(vis , 0 , sizeof(vis)) ; for(i = 0 ; i < hull.size() ; i++) vis[hull[i].id] = 1 ; pcnt = 0 ; for(i = 0 ; i < n ; i++){ if(vis[i] && !vis[(i+1)%n]) pcnt++ ; } qcnt -= pcnt ; cout<< max(0 , q * qcnt - p * pcnt )<< endl ; } return 0 ;}
^
0_0_29473693_6371.cpp: At global scope:
0_0_29473693_6371.cpp:1:849: error: 'vector' does not name a type
int cmp(double x){ if(fabs(x) < 1e-8) return 0 ; if(x > 0) return 1 ; return -1 ;} struct point{ double x , y ; int id ; point(){} point(double _x , double _y):x(_x) , y(_y){} friend bool operator == (const point &a , const point &b){ return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0 ; } friend double operator ^ (const point &a , const point &b){ return a.x * b.y - a.y * b.x ; } friend double dist(const point &a , const point &b){ return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ) ; } point operator - (point o){ return point(x - o.x , y - o.y) ; }}; bool cmpless(const point &a , const point &b){ return cmp(a.x - b.x) < 0 || cmp(a.x - b.x == 0) && cmp(a.y - b.y) < 0 ;} vector<point> convex_hull(vector<point> a){ vector<point> src(2 * a.size() + 5) ; sort(a.begin() , a.end() , cmpless) ; a.erase(unique(a.begin() , a.end()) , a.end()) ; int m = 0 ; for(int i = 0 ; i < a.size() ; i++){ while(m > 1 && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2]) ) <= 0) m-- ; src[m++] = a[i] ; } int k = m ; for(int i = a.size() - 2 ; i >= 0 ; i--){ while(m > k && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2])) <= 0) m-- ; src[m++] = a[i] ; } src.resize(m) ; if(a.size() > 1) src.resize(m-1) ; return src ;} int vis[38] ; int main(){ int n , i , t , pcnt , qcnt , p , q ; cin>>t ; while(t--){ cin>>p>>q>>n ; vector<point> lis(n) ; for(i = 0 ; i < n ; i++){ scanf("%lf%lf" , &lis[i].x , &lis[i].y) ; lis[i].id = i ; } vector<point> hull = convex_hull(lis) ; qcnt = hull.size() ; memset(vis , 0 , sizeof(vis)) ; for(i = 0 ; i < hull.size() ; i++) vis[hull[i].id] = 1 ; pcnt = 0 ; for(i = 0 ; i < n ; i++){ if(vis[i] && !vis[(i+1)%n]) pcnt++ ; } qcnt -= pcnt ; cout<< max(0 , q * qcnt - p * pcnt )<< endl ; } return 0 ;}
^
0_0_29473693_6371.cpp: In function 'int main()':
0_0_29473693_6371.cpp:1:1572: error: 'cin' was not declared in this scope
int cmp(double x){ if(fabs(x) < 1e-8) return 0 ; if(x > 0) return 1 ; return -1 ;} struct point{ double x , y ; int id ; point(){} point(double _x , double _y):x(_x) , y(_y){} friend bool operator == (const point &a , const point &b){ return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0 ; } friend double operator ^ (const point &a , const point &b){ return a.x * b.y - a.y * b.x ; } friend double dist(const point &a , const point &b){ return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ) ; } point operator - (point o){ return point(x - o.x , y - o.y) ; }}; bool cmpless(const point &a , const point &b){ return cmp(a.x - b.x) < 0 || cmp(a.x - b.x == 0) && cmp(a.y - b.y) < 0 ;} vector<point> convex_hull(vector<point> a){ vector<point> src(2 * a.size() + 5) ; sort(a.begin() , a.end() , cmpless) ; a.erase(unique(a.begin() , a.end()) , a.end()) ; int m = 0 ; for(int i = 0 ; i < a.size() ; i++){ while(m > 1 && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2]) ) <= 0) m-- ; src[m++] = a[i] ; } int k = m ; for(int i = a.size() - 2 ; i >= 0 ; i--){ while(m > k && cmp( (src[m-1] - src[m-2]) ^ (a[i] - src[m-2])) <= 0) m-- ; src[m++] = a[i] ; } src.resize(m) ; if(a.size() > 1) src.resize(m-1) ; return src ;} int vis[38] ; int main
|