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

Ended

Participants:405

Verdict:Wrong Answer
Score:0 / 100
Submitted:2017-07-23 14:19:26

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<map>
#include<set>
#include<algorithm>
using namespace std;
bool findpath(map<int,vector<int>>& G, int x1, int y1, vector<int>& path,vector<int> tmp, vector<bool>& visited){
    if(x1==y1){
        visited[y1]=true;
        tmp.push_back(y1);
        path=tmp;
        return true;
    }
    for(int i=0;i<G[x1].size();i++){
        if(!visited[G[x1][i]]){
            visited[G[x1][i]]=true;
            tmp.push_back(G[x1][i]);
            if(findpath(G,G[x1][i],y1,path,tmp,visited)){
                return true;
            }
            tmp.pop_back();
        }
    }
    return false;
}
bool isoverlap(map<int,vector<int>>& G,int x1,int y1,int x2,int y2){
    vector<bool> visited1(G.size(),false),visited2(G.size(),false);
    vector<int> path1,path2;
    vector<int> tmp;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX