Tên đăng nhập Điểm Bài tập ▴ Giới thiệu
20401 998 4
20402
ngngoc
Tinia
1355 4
20403 2417 4
20404 747 4
20405 719 4
20406 1260 4
20407
OLP4SC048
Lê Trung Minh Nhật
1825 4
20408 1929 4
20409 1723 4
20410 3441 4
20411 1187 4
20412 1051 4
20413 2591 4
20414 1463 4
20415
lamnkhdk
Nguyễn Khánh Lâm
375 4
20416
STR07Hieu
Trần Ngọc Hiếu
457 4
20417
STR60Thang
Lê Tiến Thăng
375 4
20418
STRB14Phuc
Nguyễn Huỳnh Anh Phúc
855 4
20419
STRB16Nhat
Lê Bá Minh Nhật
945 4
20420
STRB17Huy
Trần Võ Quốc Huy
855 4
20420
STRB19Bao
Phùng Anh Bảo
855 4
20420
STRB37Khoa
Võ Như Khoa
855 4
20420
STRB43Chuong
Nguyễn Hữu Chương
855 4
20420
STRB56Hang
Nguyễn Thị Thanh Hằng
855 4
20420
STRB59Phong
Nguyễn Trung Hải Phong
855 4
20426 375 4
20426 375 4
20428 2161 4
20429 821 4
20430 475 4
20431 4334 4
20432 2143 4
20433 1178 4
20434 1038 4
20435 941 4
20436
yueakayue
TranVuAnh
187 4

Nothing here

20437 4040 4
20438 375 4
20439 746 4
20440 1170 4
20441 834 4
20442 1170 4
20443 594 4
20444 1011 4
20445 375 4
20446 726 4
20447 971 4
20448 800 4
20449 561 4
20450 375 4
20450 375 4
20452 2880 4
20453 375 4
20454 2558 4
20455 2660 4
20456 1047 4
20457 2009 4
20458 1022 4
20459 1117 4
20460 1075 4
20460 1075 4
20460 1075 4
20460 1075 4
20460 1075 4
20460 1075 4
20466 1324 4
20467 348 4
20468 765 4
20469 1075 4
20470 1034 4

Account này đã bị ban vì phát hiện hành vi không trung thực khi làm bài tập: chép code, if test để AC. Chi tiết xin liên hệ Lê Tăng Phú Quý

20471 375 4
20472 1075 4
20472 1075 4
20472 1075 4

import java.util.*;
public class bai41{
public static void array(int[] c){
for(int i = 0 ; i < c.length-1 ;i++) {
for(int j = i +1 ; j < c.length ; j++) {
if(c[i] > c[j]) {
int temp = c[i];
c[i] = c[j];
c[j] = temp;
}
}
}
}
public static void main(String[] args){
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
int[] a = new int[n];
for(int i = 0 ; i < a.length ;i++){
a[i] = reader.nextInt();
}
array(a);
for(int i = 0 ; i < a.length ;i++){
System.out.print(a[i] + " ");
}
}
}

20472 1075 4
20476 2981 4
20477 2440 4
20478 1075 4
20478 1075 4
20478 1075 4
20481 994 4
20482 1075 4
20482 1075 4
20484 3457 4
20485
tienmy09
Nguyễn Tiến Mỹ
3131 4
20486 2120 4
20487 3828 4

NOthing

20488 2333 4
20489 4468 4

include <bits/stdc++.h>

using namespace std;

int x,y;

int main()

{

  cin>>x>>y;

  cout<<max(x,y); //tgc có 2 cạnh bằng nhau nên chọn cạnh lớn hơn để có diện tích lớn nhất.

}

20490 2154 4
20491 1064 4
20492 1075 4
20493 2011 4
20494 912 4
20495 2008 4
20496 2785 4
20497 626 4
20498 412 4
20499 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;
}

20500 1237 4