hiho week 140 register

Ended

Participants:351

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-04 22:33:05

Lang:G++

Edit
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
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<int> graph[1000];
bool cover[1000][2][2];
int coor[1000][2][2];
bool visited[1000];
int cnt;
void dfs(int i) {
    ++cnt;
    visited[i] = true;
    for (int j:graph[i]) {
        if (!visited[j]) dfs(j);
    }
}
int main() {
    int W, H, N;
    cin >> W >> H >> N;
    for (int i=0; i<N; ++i) {
        auto coori = coor[i];
        cin >> coori[0][0] >> coori[0][1] >> coori[1][0] >> coori[1][1];
        for (int j=0; j<i; ++j) {
            auto coorj = coor[j];
            if (coori[0][0]<coorj[1][0] && coori[1][0]>coorj[0][0] && coori[0][1]<coorj[1][1] && coori[1][1]>coorj[0][1]) {
                graph[j].push_back(i);
                for (int a=0; a<2; ++a) {
                    for (int b=0; b<2; ++b) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX