[Offer收割]编程练习赛74 register

Ended

Participants:109

Verdict:Time Limit Exceeded
Score:60 / 100
Submitted:2018-08-26 14:13:14

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<stdio.h>
#include<string.h>
typedef struct Node{
    int x, y;
    Node(){}
}Node;
int length;
Node shuzu[100005];
int flag[100005];
int tag[100005] = {0};
int dead[100005] ;
int dfs(int input){
    for(int i = 0; i < length; i++){        
        if(input==i || flag[i] == 1) continue;
        if(shuzu[input].x!=shuzu[i].x && shuzu[input].y!=shuzu[i].y) continue;
        flag[i] = 1;
        if( tag[i] == -1 || dfs(i)){
//          tag[i] = input;
//          dead[input] = i;
//            if(tag[input]!=-1)return 0;
            tag[input] = i;
            return 1;
        }
    }
    return 0;
} 
int main(){
    scanf("%d", &length);
    for(int i = 0; i < length; i++) scanf("%d%d", &shuzu[i].x, &shuzu[i].y);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX