Username Points Problems About
1
vongocsinh 1948
Võ Ngọc Sinh
37177 343
2
memeq 1931
Võ Ngọc Sinh
8806 17
3
khactrung1912 1788
Nguyễn Khắc Trung
37471 319
4
trvhung 1720
Trần Việt Hưng
33974 178
5 5929 6
6
phamducminh538 1565
Phạm Đức Minh
41235 703
7
Sang522008 1525
Nguyễn Ngọc Cao Sang
37428 880

Nick Phụ: nguyenngoccaosang , NNCS

Newbie


#include <bits/stdc++.h>

using namespace std;

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

Profile
FaceBook

8
nguyenngoccaosang 1442
Nguyễn Ngọc Cao Sang
20061 76

Acc phụ của Sang522008

9 1792 2
10
thuongvng 1393
Trần Nguyễn Đan Quỳnh
19603 334
11 8153 38
12 35282 511
13
Syn 1325
4521 8
14
tk22NguyenPhuongLam 1301
Nguyễn Phương Lâm
20490 329

Blockquote

Đây là:enter code hể

summary

summary
  • \[$detail$\]

15
nguyenminhkhoi1234 1291
NguyenMinhKhoi
22913 176

Hello! I'm Nguyen Minh Khoi 🙂

16
n2loclm 1233
Lê Minh Lộc
32778 689
17
nguyenthinhuquynh 1227
Nguyễn Thị Như Quỳnh
24422 101

an tê ô

18
nguyenanhdaoht12 1223
nguyenvangiabao
5986 76

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

19 10187 14
20
HUNG_009 1070
Nguyễn Quang Nhật Hùng
20626 50

nhathung deptrai khoai to

21
Ragnakrog 1069
Quá khó để quên em
16052 50
22
elsu 989
NoNameNoBody
26053 213

Tôi elsu
Bị aaiibbxx phá hoại cuộc sống

23 0 0
23 0 0
25 2050 6
26 16324 21
27 24752 164
28 7201 21
29
yenmai2832008
Vũ Thị Yến Mai
15493 125

hi 🙂

30 23695 70
31 14649 29
32 101 1
33 4313 9
34 12648 16
35 2884 8
36 9702 29
37 621 2
38
anhuynt
Trịnh Nguyễn An Huy
2575 4
39 1849 15
40 0 0
40 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;
}

42 1501 1
43 1132 4
44 288 3
45 0 0
45 0 0
45 0 0
48 200 1
49
hnhlongvbh
Võ Hoàng Bảo Long
7141 24
50
hnhlongtm
Trần Minh Long
962 13
51 0 0
51 0 0
53 269 1
54 6395 14
55 101 1
56 8205 45
57 0 0
57 0 0
59 401 1
60 0 0
61 541 2
62 0 0
63 45 1
63 45 1
65 943 9
66
BaAnhHT
Hoàng Bá Anh
0 0
66 0 0
68 2161 4
69 0 0
69 0 0
71 225 2
72 9795 13
73 0 0
73 0 0
73 0 0

nothing

76
Critcal
Nguyen Le Chau
12625 79

I, Diamond Sword, will strike you down! Okay just kidding but... Why are you even here? Well, you maybe my classmates but still, what is the point of coming here if you are not a hacker or some ragebaiter who decide to copyright strike the Nyan Cat?
Seriously, I can't be serious, like there can't be a single time where I just don't burst out laughing even at a moment where I don't want to. By the way, I am Critcal and I love Nyan Cat so that explain the words I just said, and to finish it off here is a gif of Nyan Cat and here is some EMOjis: 🙂 🙁 😈 😠 :

77 0 0
78 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;
}

79 7812 23
80 1310 7
81 23386 74
82 5860 70
83 0 0
84 7561 40
85 0 0
86 2378 5
87 197 2
88 40 1
89 2637 2
90 1423 9
91
MinhBùi_288
Bùi Minh
22389 119

92 197 2
93 0 0

bhhh

94 13859 67
95 1447 5
96 3500 7

sssss

97 201 1
98 1880 13
99 197 2
100 7689 42