MSBOP 2015 Round2B register

Ended

Participants:6187

Verdict:AC | AC
Submitted:2015-04-26 14:57:25

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 <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
const int MAXN = 1e6 + 7, Mo = 1e9 + 7;
int N, M, K;
int w[MAXN], u[MAXN];
int getr(int s){
    if (u[s] == s) return s;
    return u[s] = getr(u[s]);
}
void init(){
    scanf("%d%d%d", &N, &M, &K);    
    for (int i=1; i<=N; i++){
        scanf("%d", w+i);
        u[i] = i;
    }   
    for (int i=0; i<M; i++){
        int x, y; scanf("%d%d", &x, &y);        
        if (getr(x) != getr(y)) u[u[x]] = u[y];     
    }   
}
PII b[MAXN], mi[MAXN];
void solve(){
    for (int i=1; i<=N; i++) mi[i] = PII(1e9, 0);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX