Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <cmath>
- #include <vector>
- using namespace std;
- double S(double x1,double y1,double x2,double y2,double x3,double y3)
- {
- return abs((x1*(y2-y3)-x2*(y1-y3)+x3*(y1-y2))/2);
- }
- bool check(double x1,double y1,double x2,double y2,double x3,double y3,double x,double y)
- {
- return abs(S(x1,y1,x2,y2,x,y)+S(x1,y1,x3,y3,x,y)
- +S(x2,y2,x3,y3,x,y)-S(x1,y1,x2,y2,x3,y3))<=0.00001;
- }
- double d(double x1,double y1,double x2,double y2)
- {
- return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
- }
- int main()
- {
- ifstream in("theodore.in");
- ofstream out("theodore.out");
- ofstream log("theodore.log");
- int n,m,k;in>>n>>m>>k;
- vector<double> x(n),y(n);
- for(int i=0;i<n;i++)in>>x[i]>>y[i];
- double als=0;
- for(int i=1;i<n-1;i++)als+=S(x[0],y[0],x[i],y[i],x[i+1],y[i+1]);
- int cnt=0;
- for(int i=0;i<m;i++)
- {
- double xp,yp;
- in>>xp>>yp;
- double as=0;
- for(int i=0;i<n;i++)
- as+=S(xp,yp,x[i],y[i],x[(i+1)%n],y[(i+1)%n]);
- if(abs(as-als)<1e-4)
- {
- log<<"YES\n";
- cnt++;
- }
- else log<<"NO\n";
- }
- out<<(cnt>=k?"YES":"NO")<<'\n';
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment