#include #include #include #include #include using namespace std; //最大角、最小角 typedef pair ENEMY; static const double PI = 4.0 * atan(1.0); static const double PI2 = 8.0 * atan(1.0); static const double EPS = 1e-10; int main() { for (int N; cin >> N && N;){ list enemies; for (int i = 0; i < N; ++i){ ENEMY enemy(-1e10, 1e10); //最大角,最小角 double left, bottom, right, top; cin >> left >> bottom >> right >> top; if (right < 0 && bottom < EPS && -EPS < top){ //x軸と左側で交わる enemy.first = atan2(bottom, right); enemy.second = atan2(top, right); if (enemy.first > 0){ enemy.first -= PI2; } if (enemy.second > 0){ enemy.second -= PI2; } } else { enemy.first = max(enemy.first, atan2(bottom, left)); enemy.second = min(enemy.second, atan2(bottom, left)); enemy.first = max(enemy.first, atan2(bottom, right)); enemy.second = min(enemy.second, atan2(bottom, right)); enemy.first = max(enemy.first, atan2(top, left)); enemy.second = min(enemy.second, atan2(top, left)); enemy.first = max(enemy.first, atan2(top, right)); enemy.second = min(enemy.second, atan2(top, right)); } enemies.push_back(enemy); } int answer = INT_MAX; enemies.sort(); for (int loop = 0; loop < N; ++loop){ list::iterator it = enemies.begin(); int counter = 0; while (it != enemies.end()){ const double r = it->first; while (it != enemies.end() && it->second < r + EPS){ ++it; } //fprintf(stderr, "%d ", startIndex); ++counter; } //fprintf(stderr, "\n"); enemies.begin()->first += PI2; enemies.begin()->second += PI2; enemies.push_back(enemies.front()); enemies.pop_front(); answer = min(answer, counter); } cout << answer << endl; } }