hiho week 140 register

Ended

Participants:351

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-08 10:32:34

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;
const int maxn=1011;
struct Post{
    int x1,x2,y1,y2;
}ps[maxn];
bool intersect(Post& a,Post& b){
    return (!(a.x1>=b.x2 || b.x1>=a.x2 || a.y1>=b.y2 || b.y1>=a.y2));
}
bool inrec(int x,int y,Post& a){
    return (x>a.x1 && x<a.x2 && y>a.y1 && y<a.y2);
}
bool vis[maxn];
int w,h,n;
void  dfs(int s){
    vis[s]=true;
    for(int i=s+1;i<n;i++){
        if(!intersect(ps[s],ps[i])) continue;
        if(!vis[i]) dfs(i);
    }
}
int main(){
    cin>>w>>h>>n;
    for(int i=0;i<n;i++){
        cin>>ps[i].x1>>ps[i].y1>>ps[i].x2>>ps[i].y2;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX