text: size(); int ret = -1; for(int i=0; i<n; i++){ P a = poly[i]-p; P b = poly[(i+1)%n]-p; if(a.Y > b.Y) swap(a,b); if(intersectSP(L(a,b), P(0,0))) return 0; if(a.Y<=0 && b.Y>0 && cross(a,b)<0) ret = -ret; } return ret; } VP convex(VP v){ VP ret; int n = v.size(); sort(v.begin(), v.end()); for(int i=0; i<n; i++){ while((int)ret.size()>1 && cross(ret.back()-ret[ret.size()-2], v[i]-ret.back()) < EPS){ ret.pop_back(); } ret.push_back(v[i]); } int t = ret.size(); for(int i=n-2; i>=0; i--){ while((int)ret.size()>t && cross(ret.back()-ret[ret.size()-2], v[i]-ret.back()) < EPS){ ret.pop_back(); } ret.push_back(v[i]); } if((int)ret.size() > 1) ret.pop_back(); return ret; } pair<vector<vector<double> >, VP> arrangementEX(const vector<L> &l, const VP &p){ vector<VP> cp(l.size()); VP plist = p; for(int i=0; i<(int)l.size(); i++){ for(int j=i+1; j<(int)l.size(); j++){ if(!isParallel(l[i], l[j]) && intersectSS(l[i], l[j])){ P cpij = crosspointLL(l[i], l[j]); cp[i].push_back(cpij); cp[j].push_back(cpij); plist.push_back(cpij); } } for(int j=0; j<(int)p.size(); j++){ if(intersectSP(l[i], p[j])){ cp[i].push_back(p[j]); } } cp[i].push_back(l[i][0]); cp[i].push_back(l[i][1]); plist.push_back(l[i][0]); plist.push_back(l[i][1]); sort(cp[i].begin(), cp[i].end()); cp[i].erase(unique(cp[i].begin(), cp[i].end()), cp[i].end()); } sort(plist.begin(), plist.end()); plist.erase(unique(plist.begin(), plist.end()), plist.end()); int n = plist.size(); map<P, int> conv; for(int i=0; i<n; i++){ conv[plist[i]] = i; } vector<vector<double> > adj(n, vector<double>(n, INF)); for(int i=0; i<(int)cp.size(); i++){ for(int j=0; j<(int)cp[i].size()-1; j++){ int jidx = conv[cp[i][j]]; int jp1idx = conv[cp[i][j+1]]; adj[jidx][jp1idx] = adj[jp1idx][jidx] = 0; } } return make_pair(adj, plist); } int main(){ while(1){ //input int n,m; cin >> n >> m; if(n == 0) break; vector<VP> poly(n); vector<double> h(n); for(int i=0; i<n; i++){ int nv; cin >> nv >> h[i]; poly[i].