Subject to the effect:
Pile robot, known to their initial position (x, y), would have been moved in the four directions can be, but for some reason, the robot can not move a certain direction, which is represented by 1 can be moved, with 0 otherwise
Can they seek to reach the same point, if we can, at this point output coordinates
Thinking: maintaining most four values, a, b, c, d
A represents a group of left x coordinate of the lower bound of the robot can reach, b represents the upper bound can move on the y, c denotes the upper bound of the right x, d y represents the lower bound down
Each encounter can not move in a direction of the robot, updates the corresponding value.
Final judgment on whether the lower bound of the cross-border non-empty
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define pair<int,int> P #define endl '\n' #define MAXN 100006 int n,m; #define read(A) for(int i=0;i<n;i++)scanf("%I64d",&A[i]); ll x,y; ll a=-MAXN+6, b=MAXN-6,c=MAXN-6, d=-MAXN+6; int main() { int t; scanf("%d",&t); int _a; while(t--){ a=-MAXN+6, b=MAXN-6,c=MAXN-6, d=-MAXN+6; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%I64d%I64d",&x,&y); for(int j=0;j<4;j++){ scanf("%d",&_a); if(j==0&&_a==0)a=max(x,a); if(j==1&&_a==0)b=min(b,y); if(j==2&&_a==0)c=min(c,x); if(j==3&&_a==0)d=max(d,y); } } if(a>c||b<d){ // cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl; puts("0"); coutElse }{<<1<<' '<<a<<' '<<b<<'\n'; } } }