๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
vector<int> tree[MAX_N];
vector<int> houses[MAX_N];
int A[MAX_N];
int parent[MAX_N];
void dfs(int node) {
houses[node].push_back(A[node]);
for (int child : tree[node]) {
if (child == parent[node]) continue;
parent[child] = node;
dfs(child);
houses[node].insert(houses[node].end(), houses[child].begin(), houses[child].end());
}
sort(houses[node].begin(), houses[node].end());
}
int getMaxD(int X, int K, vector<int>& housesInSubtree) {
int low = 0, high = 1000000000, bestD = 0;
while (low <= high) {
int mid = (low + high) / 2;
int count = 0;
int left = X - mid, right = X + mid;
auto lower = lower_bound(housesInSubtree.begin(), housesInSubtree.end(), left);
auto upper = upper_bound(housesInSubtree.begin(), housesInSubtree.end(), right);
count = upper - lower;
if (count <= K) {
bestD = mid;
low = mid + 1;
} else {
high = mid - 1;
}
}
return bestD;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, Q;
cin >> N >> Q;
for (int i = 1; i <= N; ++i) {
cin >> A[i];
}
for (int i = 1; i < N; ++i) {
int u, v;
cin >> u >> v;
tree[u].push_back(v);
tree[v].push_back(u);
}
parent[1] = -1;
dfs(1);
int result = 0;
while (Q--) {
int U, X, K;
cin >> U >> X >> K;
int d = getMaxD(X, K, houses[U]);
result ^= d;
}
cout << result << endl;
return 0;
}
Bad Guy โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Equifax is hiring Java Developer
For 2023, 2024 grads
Location: Pune / Trivandrum
https://careers.equifax.com/en/jobs/j00162626/java-developer-entry/
For 2023, 2024 grads
Location: Pune / Trivandrum
https://careers.equifax.com/en/jobs/j00162626/java-developer-entry/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Orange Health is hiring Software Engineer
For 2021, 2022, 2023 grads
Location: Bangalore
https://app.pyjamahr.com/careers?company=Orange%20Health&job_id=159193&company_uuid=8A364EBF43&source=LINKEDIN&apply_now=true
For 2021, 2022, 2023 grads
Location: Bangalore
https://app.pyjamahr.com/careers?company=Orange%20Health&job_id=159193&company_uuid=8A364EBF43&source=LINKEDIN&apply_now=true
int findmaximumPackages(vector<int>&arr)
{
int n = arr.size();
int mx = *max_element(arr.begin(), arr.end());
mx = mx * 2;
int res = 0;
map<int, int>mp;
for (auto it : arr) {
mp[it]++;
}
for (int i = 1; i <= mx; i++) {
int sm = 0;
for (int j = 1; j <= (i - 1) / 2; j++) {
sm += min(mp[j], mp[i - j]);
}
if (i % 2 == 0) {
sm += (mp[i / 2] / 2);
}
res = max(res, mp[i] + sm);
}
return res;
}
Amazon โ
{
int n = arr.size();
int mx = *max_element(arr.begin(), arr.end());
mx = mx * 2;
int res = 0;
map<int, int>mp;
for (auto it : arr) {
mp[it]++;
}
for (int i = 1; i <= mx; i++) {
int sm = 0;
for (int j = 1; j <= (i - 1) / 2; j++) {
sm += min(mp[j], mp[i - j]);
}
if (i % 2 == 0) {
sm += (mp[i / 2] / 2);
}
res = max(res, mp[i] + sm);
}
return res;
}
Amazon โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
RaajKuumar Tiwari on LinkedIn: #internship #hiring #hiringnow #hiringintern #backenddeveloperโฆ
๐ Exciting Opportunity: Backend Developer Internship in Node.js (3-Month, Remote Internship) ๐
Are you a final-year B.Tech or BE student in CS/IT looking toโฆ
Are you a final-year B.Tech or BE student in CS/IT looking toโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
DELLOITE BIGGEST OFF CAMPUS HIRING FOR 2025 BATCH
Eligibility
2025 graduates of B.E./B.Tech /M.E./M.Tech / MCA - Cyber Security, Information Technology, Computer Science and/or other ancillary Circuital Branches
Apply link : https://usrecruiting.deloitte.com/national-level-assessment-deloitte-us-india-offices?#subpage/engineeringcyber/content/211390088
Eligibility
2025 graduates of B.E./B.Tech /M.E./M.Tech / MCA - Cyber Security, Information Technology, Computer Science and/or other ancillary Circuital Branches
Apply link : https://usrecruiting.deloitte.com/national-level-assessment-deloitte-us-india-offices?#subpage/engineeringcyber/content/211390088
Deloitte
NLA by Deloitte US-India Offices
Deloitte US-India Offices presents National Level Assessment for all final-year students looking for career opportunities.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Google Forms: Sign-in | Anovora Expeditions Labs
๐ Join Our Team as an Engineer Intern at Annovora Expeditions Labs! ๐
Are you passionate about technology innovation and eager to solve real-world challenges? Annovora Expeditions Labs is looking for talented and driven Engineer Interns to work exclusivelyโฆ
Are you passionate about technology innovation and eager to solve real-world challenges? Annovora Expeditions Labs is looking for talented and driven Engineer Interns to work exclusivelyโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: DoSelect (Infoedge)
Different intern roles are there (6 months)
Apply: https://docs.google.com/forms/d/e/1FAIpQLSeyzdHcvzDKtq510sRy6usSsDut4ZLIeQKWeKK88S7Gh8Vusw/viewform
Different intern roles are there (6 months)
Apply: https://docs.google.com/forms/d/e/1FAIpQLSeyzdHcvzDKtq510sRy6usSsDut4ZLIeQKWeKK88S7Gh8Vusw/viewform
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name : CoinDCX
Challenge Name : Unfold Hackathon 2024
Eligibility : All College Students + Working Professionals
Prizes : Bounties worth $100K + opportunities at CoinDCX and various companies
Link : https://bit.ly/coindcxunfold
Challenge Name : Unfold Hackathon 2024
Eligibility : All College Students + Working Professionals
Prizes : Bounties worth $100K + opportunities at CoinDCX and various companies
Link : https://bit.ly/coindcxunfold
unfold2024.devfolio.co
Unfold 2024 | Devfolio
Build for web3. Innovate the future.
๐คฎ1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)