10 vector
<int> edges
[2*N
+ 30];
23 for(int i
= 0 ; i
< edges
[node
].size() ; i
++ ){
24 int w
= edges
[node
][i
];
25 if( tipo
[w
] == 0 ) minid
= min ( minid
, DFS3(w
));
26 else if( tipo
[w
] == 1 ) minid
= min ( minid
, id
[w
]);
28 if( minid
== id
[node
] ){
31 int n
= pila
.top(); CC
[n
] = SCC
;pila
.pop();
32 if( n
== node
) break;
44 for(int h
= 0; h
< casos
; h
++){
45 for(i
=0;i
<2*N
+30;i
++) edges
[i
].clear();
48 scanf("%i %i %i", &row
, &col
, &cant
);
51 scanf("%i %i %i %i", &f1
, &c1
, &f2
, &c2
);
57 edges
[N
+c1
].push_back(c1
);
59 // printf("col = %i %i %i %i\n", f1, c1, f2, c2);
60 edges
[c1
].push_back(N
+c1
);
67 edges
[N
+f1
].push_back(f1
);
69 // printf("fila = %i %i %i %i\n", f1, c1, f2, c2);
70 edges
[f1
].push_back(N
+f1
);
74 edges
[N
+f1
].push_back(f2
);
75 edges
[N
+f1
].push_back(c1
);
76 edges
[N
+c2
].push_back(f2
);
77 edges
[N
+c2
].push_back(c1
);
78 edges
[N
+f2
].push_back(f1
);
79 edges
[N
+f2
].push_back(c2
);
80 edges
[N
+c1
].push_back(f1
);
81 edges
[N
+c1
].push_back(c2
);
83 edges
[f1
].push_back(N
+f2
);
84 edges
[f1
].push_back(c1
);
85 edges
[N
+c2
].push_back(N
+f2
);
86 edges
[N
+c2
].push_back(c1
);
87 edges
[f2
].push_back(N
+f1
);
88 edges
[f2
].push_back(c2
);
89 edges
[N
+c1
].push_back(N
+f1
);
90 edges
[N
+c1
].push_back(c2
);
94 edges
[N
+f1
].push_back(f2
);
95 edges
[N
+f1
].push_back(N
+c1
);
96 edges
[c2
].push_back(f2
);
97 edges
[c2
].push_back(N
+c1
);
98 edges
[N
+f2
].push_back(f1
);
99 edges
[N
+f2
].push_back(N
+c2
);
100 edges
[c1
].push_back(f1
);
101 edges
[c1
].push_back(N
+c2
);
103 edges
[f1
].push_back(N
+f2
);
104 edges
[f1
].push_back(N
+c1
);
105 edges
[c2
].push_back(N
+f2
);
106 edges
[c2
].push_back(N
+c1
);
107 edges
[f2
].push_back(N
+f1
);
108 edges
[f2
].push_back(N
+c2
);
109 edges
[c1
].push_back(N
+f1
);
110 edges
[c1
].push_back(N
+c2
);
116 memset(CC
, -1, sizeof(CC
));
117 memset(id
, -1, sizeof(id
));
118 memset(tipo
, 0, sizeof(tipo
));
120 if( CC
[i
] < 0 ) DFS3(i
);
121 if( CC
[i
+ N
] < 0 ) DFS3(i
+ N
);
122 if( CC
[i
] == CC
[i
+N
] ) vale
= 0;
125 for(i
=MED
+1;i
<= MED
+ col
;i
++){
126 if( CC
[i
] < 0 ) DFS3(i
);
127 if( CC
[i
+ N
]< 0 ) DFS3(i
+ N
);
128 if( CC
[i
] == CC
[i
+N
] ) vale
= 0;
131 if( vale
) printf("Yes\n");