Rank Username Points ▾ Problems About
1
vongocsinh 1649
Võ Ngọc Sinh, Quảng Bình
36165 335
2
phamducminh538 1709
Pham Duc Minh
35435 565

3
khactrung1912 1528
Nguyễn Khắc Trung
33957 184
4
Sang522008 1525
Nguyễn Ngọc Cao Sang
33140 727

Nick Phụ (chơi contest): nguyenngoccaosang

#include <bits/stdc++.h>

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout<<"Cao Sangg";
}

Profile
FaceBook

5
n2loclm 1234
Lê Minh Lộc
32160 660
6
huyquang_25 1541
Lê Quang Huy
31441 446
7
trvhung 1727
Trần Việt Hưng
27553 142
8 25348 319
9 25331 164
10
elsu 989
NoNameNoBody
24754 209

I am elsu
Bị aaiibbxx phá hoại cuộc sống

11 21114 59
12
nguyenngoccaosang 1442
Nguyễn Ngọc Cao Sang
20061 76

Acc phụ của Sang522008

13
Ragnakrog 1070
Quá khó để quên em
16052 50
14 13005 65
15
yenmai2832008
Vũ Thị Yến Mai
12402 119

hi :)

16
tk22NguyenPhuongLam 1301
Nguyễn Phương Lâm
11809 216
*ông trùm liên fai😎😎😎🤓🤓🤓🤓*
17 11497 20
18 11154 11
19 10187 14
20
loveTQ
Ng
9795 13
21 9367 25
22 9202 47
23 7754 43
24 7375 39
25 6112 18
26
komasan 1618
5929 6
27 5322 70
28
nguyenminhkhoi1234
NguyenMinhKhoi
5252 56
29 5190 35
30 4654 4

include<bits/stdc++.h>

using namespace std;

define endl "\n"

define pb push_back

define ll long long

const int maxn=1e6+1;

vector<int>adj[maxn],queries[maxn];
int n,q,par[maxn],rnk[maxn],ancestor[maxn];
bool visited[maxn];
map<pair\<int,int>,int>mp;
vector<pair\<int,int>>ans;

int find_set(int u){
while(par[u]!=u)u=par[u];
return u;
}

void union_set(int x,int y){
int xroot=find_set(x);
int yroot=find_set(y);
if(xroot==yroot)return;
if(rnk[xroot]<rnk[yroot])par[xroot]=yroot; else if(rnk[xroot]>rnk[yroot])par[yroot] = xroot;
else{
par[xroot]=yroot;
rnk[yroot]++;
}
}

void dfs(int w){
visited[w]=true;
ancestor[w]=w;
for(int u:adj[w]){
if(!visited[u]){
dfs(u);
union_set(w,u);
ancestor[find_set(u)] = w;
}
}
for(int u:queries[w]){
if(visited[u]){
mp[{min(w,u),max(u,w)}]=ancestor[find_set(u)];
}
}
}

int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>q;
for(int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
for(int i = 1; i <= n; i++)
par[i] = i;
for (int i=1;i<=q;i++) {
int u, v;
cin >> u >> v;if (u>v)swap(u,v);ans.pb({u,v});
queries[u].push_back(v);
queries[v].push_back(u);
}
dfs(1);
for (auto u:ans)cout<<mp[u]<<endl;
}

31
memeq 1907
mezz
4628 9
32
Syn 1326
4521 8
33
nguyenanhdaoht12 1223
nguyenvangiabao
3488 74

tôi tên là nguyễn văn giabao học sinh lớp 3/1.ha

34 2836 5

sssss

35 2310 6
36 2050 6
37 1952 15

This account was made to exercise coding skill and also, it was my program languages teacher tell me and his other pupils to do. Now it's time to moving to other things.
I know this doesn't talk about my information but that is MY PRIVATE INFO that i can't tell to YOU, the one who is reading this. I was pretty nervous when i see the problems tab of me are different, but it's just a setting. it took me some time to found it's a setting, pretty fun question, right? Alright, thanks for reading this!

38 1880 13
39 1876 7
40 1849 15
41
anhuynt
Trịnh Nguyễn An Huy
1541 3
42 1501 1
42 1447 5
44 1325 5
45 1227 8
46
TQH0410 1365
1203 3
47 1132 4
48 943 9
49 923 4
50
hnhlongtm
Trần Minh Long
906 12
51
hnhlongvbh
Võ Hoàng Bảo Long
872 11
52 723 9
53 621 2
54 610 7
55 587 2
56 541 2
57 401 1
58 288 3
59 269 1
60 225 2
61 201 1
61 200 1
61 197 2
61 197 2
61 197 2
66 101 1
66 101 1
68 45 1
68 45 1
70 40 1
71
thuongvng
Nguyễn Thị Thương
0 0
71 0 0
71 0 0

include<bits/stdc++.h>

using namespace std;
vector<int> p,sl, mx;
void init(int n) {
p.resize(n+1);
sl.resize(n+1);
mx.resize(n+1);
for (int i=1; i<=n; i++){
p[i] = i;
sl[i]= 1;
mx[i]=i;
}

}

int find (int a) {
if (a == p[a]) return a;
return p[a]=find(p[a]);
}

void union_set (int a, int b) {
a = find(a);
b = find(b);
if (p[a]>p[b]) {
swap(a,b);
p[a]+= p[b];
p[b] = a;
}
}

int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,m;
cin>> n>> m;
init(n);
int tg =n;
while (m--){
int a,b;
cin>> a>> b;
if (union_set(a, b)) {
sl = max(sl, p.size(a));
tg--;
}
cout<< tg << ' ' << sl << '\n';
}
return 0;
}

71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71
BaAnhHT
Hoàng Bá Anh
0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71 0 0

nothing

71 0 0
71 0 0
71 0 0
71 0 0
71 0 0
71
dfghjdfghjk506
duong1234
0 0

bhhh

71 0 0
71 0 0