#include using namespace std; #define LL long long #define lowbit(x) ((x) & -(x)) #define lson l,mid,id<<1 #define rson mid+1,r,id<<1|1 #define MID(l, r) (((l)+(r))>>1) const int maxn = (int) 5e2 + 20; const int MOD = 1e9 + 7; //const int MOD = 998244353; const double eps = 1e-8; inline int sig(double x) {return x < -eps ? -1 : x > eps;} template < typename T > inline void read(T &x) { static bool f; static char ch; f = 0; x = 0; ch = getchar(); while(ch < '0' || '9' < ch) {if(ch == '-') f = 1; ch = getchar();} while('0' <= ch && ch <= '9') {x = (x << 3) + (x << 1) + (ch - '0'); ch = getchar();} if(f) x = -x; } LL fp(LL a, LL n, LL m = MOD) { LL res = 1; while(n) { if(n & 1) res = res * a % m; a = a * a % m; n >>= 1; } return res; } LL gcd(LL a, LL b) { if(!b) return a; return gcd(b, a % b); } int n; int x[maxn], x2[maxn], y[maxn], y2[maxn]; int sx, sy, ex, ey; int nx, ny; int dx[maxn], dy[maxn]; int spd[maxn][maxn][4]; int dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} }; double ti[maxn][maxn]; bool inq[maxn][maxn]; priority_queue > > pq; void dijk() { for(int i = 0; i < nx; i++) for(int j = 0; j < ny; j++) { ti[i][j] = -1; } pq.push(make_pair(-0.0, make_pair(sx, sy))); while(!pq.empty()) { double t; int a, b; t = -pq.top().first; a = pq.top().second.first; b = pq.top().second.second; pq.pop(); // cout <>n; for(int i = 0; i < n; i++) { cin >>x[i] >>y[i] >>x2[i] >>y2[i]; } cin >>sx >>sy >>ex >>ey; nx = 0; ny = 0; dx[nx++] = sx; dx[nx++] = ex; dy[ny++] = sy; dy[ny++] = ey; for(int i = 0; i < n; i++) { dx[nx++] = x[i]; dx[nx++] = x2[i]; dy[ny++] = y[i]; dy[ny++] = y2[i]; } sort(dx, dx + nx); sort(dy, dy + ny); nx = unique(dx, dx + nx) - dx; ny = unique(dy, dy + ny) - dy; for(int i = 0; i < nx; i++) { for(int j = 0; j < ny; j++) { for(int d = 0; d < 4; d++) spd[i][j][d] = 1; } } for(int i = 0; i < n; i++) { int a, b, c, d; a = lower_bound(dx, dx + nx, x[i]) - dx; b = lower_bound(dx, dx + nx, x2[i]) - dx; c = lower_bound(dy, dy + ny, y[i]) - dy; d = lower_bound(dy, dy + ny, y2[i]) - dy; for(int p = a; p <= b; p++) { for(int q = c; q <= d; q++) { for(int dd = 0; dd < 4; dd++) spd[p][q][dd]++; } } for(int p = a; p <= b; p++) { spd[p][c][3]--; spd[p][d][2]--; } for(int q = c; q <= d; q++) { spd[a][q][1]--; spd[b][q][0]--; } } // for(int i = 0; i < nx; i++) // { // for(int j = 0; j < ny; j++) // { // for(int dd = 0; dd < 4; dd++) // { // cout <>tc; for(int ca = 1; ca <= tc; ca++) { // printf("Case #%d: ", ca); work(); } return 0; }