hiho week 140 register

Ended

Participants:351

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-06 21:59:48

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 <cstdio>  
#include <cstring>  
#include <algorithm>  
#include <vector>  
using namespace std;  
int const MAX = 1e3 + 5;  
int w, h, n;  
int a1[MAX], b1[MAX], a2[MAX], b2[MAX];  
int book[MAX];  
vector<int> vt[MAX]; 
int sta,str;
int check(int i,int j)
{
    return !(a1[j]>=a2[i]||a1[i]>=a2[j]||b1[j]>=b2[i]||b1[i]>=b2[j]);
}
int cal(int x)
{
    if(a1[sta]>a1[x]&&a1[sta]<a2[x]&&b2[sta]>b1[x]&&b2[sta]<b2[x])
    str|=1;
    if(a1[sta]>a1[x]&&a1[sta]<a2[x]&&b1[sta]>b1[x]&&b1[sta]<b2[x])
    str|=2;
    if(a2[sta]>a1[x]&&a2[sta]<a2[x]&&b2[sta]>b1[x]&&b2[sta]<b2[x])
    str|=4;
    if(a2[sta]>a1[x]&&a2[sta]<a2[x]&&b1[sta]>b1[x]&&b1[sta]<b2[x])
    str|=8;
}
void dfs(int x)
{
    book[x]=1;
    for(int i=0;i<vt[x].size();i++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX