hiho Week 15 register

Ended

Participants:1653

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-13 18:54:30

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 <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <string>
using namespace std;
const int MAXN = 100005;
int n,m,node,tol,vis[MAXN],fst[MAXN],nxt[MAXN],v[MAXN],pa[MAXN],one[MAXN],oth[MAXN],ans[MAXN];
vector<int> ask[MAXN]; //  
map<int,string> recode;
map<string,int> encode;
void Edge(int a,int b){
    v[tol] = b;
    pa[b] = a;
    nxt[tol] = fst[a];
    fst[a] = tol++;
}
void init(){
    recode.clear();encode.clear();
    memset(fst,-1,sizeof(fst));
    scanf("%d",&n);
    node = 0;
    tol = 0;
    string a,b;
    pa[1] = 1;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(!encode[a]) {encode[a] = (++node);recode[node] = a;ask[node].clear();}
        if(!encode[b]) {encode[b] = (++node);recode[node] = b;ask[node].clear();}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX