-
Notifications
You must be signed in to change notification settings - Fork 2
/
c.cpp
66 lines (65 loc) · 984 Bytes
/
c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
int xmin = 0;
int ymin = 0;
int xmax = 200001;
int ymax = 200001;
int xfix = -1;
int yfix = -1;
int x, y, l, t, r, d;
for(int i=0; i<n; i++){
cin>>x>>y>>l>>t>>r>>d;
x = x + 100000;
y = y + 100000;
if(l==0){
if(x>xmin){
xmin=x;
}
}
if(r==0){
if(xmax>x){
xmax = x;
}
}
if(t==0){
if(ymax>y){
ymax = y;
}
}
if(d==0){
if(ymin<y){
ymin = y;
}
}
if(l==0 &&(r==0 && (t==0 && d==0))){
xfix = x;
yfix = y;
}
}
if(xmin>xmax || ymin >ymax){
cout<<0<<endl;
return;
}
else{
if(xfix!=-1){
if(xmin!=xfix || ymin!=yfix){
cout<<0<<endl;
return;
}
}
cout<<1<<" "<<(xmin-100000)<<" "<<(ymin-100000)<<endl;
return;
}
}
int main(){
int n;
cin>>n;
while(n>0){
n--;
solve();
}
return 0;
}