#include #include const int MAXFSIZE = 205; const int MAXFACES = 256; const int MAX = 1024; struct Elem { int a,b; Elem *next; Elem() {} Elem(int aa,int bb,Elem *n) : a(aa),b(bb),next(n) {} }; struct Point { int x,y,z; void Read() { scanf("%d%d%d",&x,&y,&z); } }; struct Face { Point P[MAXFSIZE]; int n; void Read(); int Horizontal(); void Add(); }; struct Line { int x1,x2,y; Line() {} Line(int xx1,int xx2,int yy):x1(xx1),x2(xx2),y(yy) {} }; Elem *Tab[MAX]; int Volume; int nFaces; Face Faces[MAXFACES]; int min(int a,int b) { return ab?a:b; } int cmp_Face(const void *v1,const void *v2) { return ((Face*)v1)->P[0].z - ((Face*)v2)->P[0].z; } int cmp_Line(const void *v1,const void *v2) { return ((Line*)v1)->y - ((Line*)v2)->y; } int NaLiscie(Elem *L,int x) { while(L!=NULL && L->b<=x) L=L->next; return (L!=NULL && L->a<=x); } Elem *Dodaj(Elem *L,int a,int b) { if(L==NULL) return new Elem(a,b,NULL); if(L->b<=a) { L->next = Dodaj(L->next,a,b); return L; } return new Elem(a,b,L); } Elem *Usun(Elem *L,int a,int b) { Elem *LL; if(L->b <=a) { L->next = Usun(L->next,a,b); return L; } // while(L->b <= a) L=L->next; LL=L; L=L->next; if(LL->b>b) L=new Elem(b,LL->b,L); if(LL->aa,a,L); return L; } void Read() { int f; scanf("%d",&nFaces); for(f=0;f