Тема: acm.sgu.ru 124
помогите найти ошибку в коде !!! WA 6 test
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <fstream>
#include <vector>
using namespace std;
int x1[20000],w1[20000],x2[200000],y2[200000],n,x,y;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d",&n);
for (int i = 0; i < n; i++) {
scanf("%d%d%d%d",&x1[i],&w1[i],&x2[i],&y2[i]);
}
scanf("%d%d",&x,&y);
long double ans = 0;
for (int i = 0 ; i < n; i++) {
if (x1[i] == x2[i] && x == x1[i]) {
if (w1[i] <= y && y <= y2[i] ) {
puts("BORDER");
return 0;
}
if (y2[i] <= y && y <= w1[i]) {
puts("BORDER");
return 0;
}
}
if (w1[i] == y2[i] && y == w1[i]) {
if (x1[i] <= x && x <= x2[i] ) {
puts("BORDER");
return 0;
}
if (x2[i] <= x && x <= x1[i]) {
puts("BORDER");
return 0;
}
}
long double vect = (x1[i]-x)*(y2[i]-y) - (w1[i]-y)*(x2[i]-x);
long double scal = (x1[i]-x)*(x2[i]-x)+(w1[i]-y)*(y2[i]-y);
ans+=atan2(vect,scal);
}
if (fabs(ans) < 1e-3 ) puts("OUTSIDE"); else
puts("INSIDE");
return 0;
}