hiho Week 15 register

Ended

Participants:1653

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-15 17:53:49

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 <cstdio>
#include <cstring>
#include <map>
#include <iostream>
#include <vector>
using std::cin;
using std::map;
using std::string;
using std::vector;
const int MAXN = 100000, MAXM = 100000;
string names[2 * MAXN];
int union_find_set[2 * MAXN], father[2 * MAXN],
    request_content[MAXN + 1], request_answer[MAXN + 1],
    spring_head[2 * MAXN], spring_next[2 * MAXN];
bool request_visited[MAXN + 1];
map<string, int> idx;  /*indexCompile Error*/
vector<int> requests[MAXN + 1];
/*request使head+next使vector
 *request_visitedfalserequest访
 *request_contentrequestnameindex便name
 *spring0DFS*/
int get_father(int x) {
    if (x == union_find_set[x])
        return x;
    else
        return (union_find_set[x] = get_father(union_find_set[x]));
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX