#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int INF = 1e9;
struct Node {
int value, dist;
Node(int v, int d): value(v), dist(d) {}
};
int main() {
int n, m;
cin >> n >> m;
vector<int> A(n);
vector<vector<int>> graph(n, vector<int>());
vector<vector<int>> dist(n, vector<int>(n, INF));
for (int i = 0; i < n; ++i) {
cin >> A[i];
}
for (int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
--x; --y;
graph[x].push_back(y);
graph[y].push_back(x);
dist[x][y] = dist[y][x] = 1;
}
for (int k = 0; k < n; ++k) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}
}
}
priority_queue<Node, vector<Node>, greater<Node>> pq;
for (int i = 0; i < n; ++i) {
if (A[i] > 0) {
pq.push(Node(i, 0));
}
}
long long cost = 0;
while (!pq.empty()) {
Node node = pq.top();
pq.pop();
int u = node.value;
int d = node.dist;
if (A[u] > 0) {
cost += d * A[u];
A[u] = 0;
for (int v : graph[u]) {
if (A[v] > 0) {
pq.push(Node(v, d + 1));
}
}
}
}
for (int i = 0; i < n; ++i) {
if (A[i] > 0) {
cout << -1 << endl;
return 0;
}
}
cout << cost << endl;
return 0;
}
Tree=0โ
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int INF = 1e9;
struct Node {
int value, dist;
Node(int v, int d): value(v), dist(d) {}
};
int main() {
int n, m;
cin >> n >> m;
vector<int> A(n);
vector<vector<int>> graph(n, vector<int>());
vector<vector<int>> dist(n, vector<int>(n, INF));
for (int i = 0; i < n; ++i) {
cin >> A[i];
}
for (int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
--x; --y;
graph[x].push_back(y);
graph[y].push_back(x);
dist[x][y] = dist[y][x] = 1;
}
for (int k = 0; k < n; ++k) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}
}
}
priority_queue<Node, vector<Node>, greater<Node>> pq;
for (int i = 0; i < n; ++i) {
if (A[i] > 0) {
pq.push(Node(i, 0));
}
}
long long cost = 0;
while (!pq.empty()) {
Node node = pq.top();
pq.pop();
int u = node.value;
int d = node.dist;
if (A[u] > 0) {
cost += d * A[u];
A[u] = 0;
for (int v : graph[u]) {
if (A[v] > 0) {
pq.push(Node(v, d + 1));
}
}
}
}
for (int i = 0; i < n; ++i) {
if (A[i] > 0) {
cout << -1 << endl;
return 0;
}
}
cout << cost << endl;
return 0;
}
Tree=0โ
Jai Shree Ram โค
struct Node {
int val;
Node* left;
Node* right;
Node(int val) : val(val), left(NULL), right(NULL) {}
};
Node* expand(Node* root) {
if(root->left == NULL && root->right == NULL) {
root->left = new Node(root->val);
root->right = new Node(root->val);
} else {
if(root->left != NULL) root->left = expand(root->left);
if(root->right != NULL) root->right = expand(root->right);
}
return root;
}
void print(Node* root) {
if(root == NULL) return;
cout << root->val << " ";
print(root->left);
print(root->right);
}
int val;
Node* left;
Node* right;
Node(int val) : val(val), left(NULL), right(NULL) {}
};
Node* expand(Node* root) {
if(root->left == NULL && root->right == NULL) {
root->left = new Node(root->val);
root->right = new Node(root->val);
} else {
if(root->left != NULL) root->left = expand(root->left);
if(root->right != NULL) root->right = expand(root->right);
}
return root;
}
void print(Node* root) {
if(root == NULL) return;
cout << root->val << " ";
print(root->left);
print(root->right);
}
class UserMainCode(object):
@classmethod
def strongString(cls, input1, input2):
n = len(input2)
min_strings = []
for i in range(min(input1, n)):
distribution = [''] * input1
for j in range(n):
distribution[j % input1] += input2[j]
min_string = min(distribution)
min_strings.append(min_string)
result = max(min_strings)
return result
Game of String Distribution โ
int maxSubjectsNumber(vector<int> answered, vector<int> needed, int q) {
int n=answered.size();
vector<int>L;
int c=0;
for(int i=0;i<n;i++)
{
int x=needed[i];
int y=answered[i];
if(x>y)
L.push_back(x-y);
else
c++;
}
sort(L.begin(),L.end());
int p=q;
for(int i=0;i<L.size();i++)
{
int x=L[i];
if(p<x)
break;
p-=x;
c++;
}
return c;
}
int n=answered.size();
vector<int>L;
int c=0;
for(int i=0;i<n;i++)
{
int x=needed[i];
int y=answered[i];
if(x>y)
L.push_back(x-y);
else
c++;
}
sort(L.begin(),L.end());
int p=q;
for(int i=0;i<L.size();i++)
{
int x=L[i];
if(p<x)
break;
p-=x;
c++;
}
return c;
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Leap
Role: Engineering Intern
Batch eligible: 2024 passouts only
Apply: https://leapfinance.freshteam.com/jobs/IDtsNXR4UToB/engineering-internship
Role: Engineering Intern
Batch eligible: 2024 passouts only
Apply: https://leapfinance.freshteam.com/jobs/IDtsNXR4UToB/engineering-internship
Freshteam
Hiring for Engineering Internship for Bengaluru - Internship
Posted by : Leap |
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Nexgen is Hiring !!
Role: Full Stack Web Dev Internship
Batch: 2024
๐Apply here:
https://www.nexgi.com/careers/web-internship-php-mysql-stack-with-nginx-apache/
Role: Full Stack Web Dev Internship
Batch: 2024
๐Apply here:
https://www.nexgi.com/careers/web-internship-php-mysql-stack-with-nginx-apache/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Vinove is Hiring !!
Role: Software Developer- Fresher
Experience: 0-1 years (Batch: 2024 may try)
Location: Noida
๐Apply here: https://vinove.keka.com/careers/jobdetails/52282
Role: Software Developer- Fresher
Experience: 0-1 years (Batch: 2024 may try)
Location: Noida
๐Apply here: https://vinove.keka.com/careers/jobdetails/52282
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐OpenInApp is Hiring !!
Role: Nodejs Developer Intern
Batch: 2024, 2025
๐Apply here:
https://openinapp.freshteam.com/jobs/O8glIz4btVCE/nodejs-developer-intern?ft_source=6000312750&ft_medium=6000257244
Role: Nodejs Developer Intern
Batch: 2024, 2025
๐Apply here:
https://openinapp.freshteam.com/jobs/O8glIz4btVCE/nodejs-developer-intern?ft_source=6000312750&ft_medium=6000257244
Freshteam
Hiring for Nodejs Developer Intern for Bengaluru - Internship
Posted by : OpeninApp | NODE.JS,NODEJS,NODE JS,NODEJS FRAMEWORK,BACKEND DEVELOPMENT,BACKEND FRAMEWORK
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Jar is Hiring !!
Role: Android Developer - Intern
Batch: 2024, 2025
๐Apply here:
https://jobs.lever.co/jar-app/64e9cb31-b06c-4dfc-a1ef-29a1021e0f58
Role: Android Developer - Intern
Batch: 2024, 2025
๐Apply here:
https://jobs.lever.co/jar-app/64e9cb31-b06c-4dfc-a1ef-29a1021e0f58
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Fortive is Hiring !!
Role: SW Intern
Location: Bangalore
๐Apply here: https://careers.fortive.com/job/FORTUSADV003161/SW-Intern
Role: SW Intern
Location: Bangalore
๐Apply here: https://careers.fortive.com/job/FORTUSADV003161/SW-Intern
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Pivotree are looking to onboard Freshers (BSc/B.E /B.Tech) 2023 passout.
Office Location - Bangalore
Eligibility Criteria -
75% & above throughout 10th, 12th & Graduation
Pass out Batch Academic Year 2023
Major Criteria : Should be good in Computer Science core subjects, Database, Data structure, and coding .Good verbal and written skill.
Note - Shortlisted candidates will be called for Assessment Test followed by inperson interview at Bangalore office.
Candidates who have appeared for Aptitude test in last 6 months cannot be considered.
Please apply for the job over email us on vijeta.padwal@pivotree.com/ vedant.jadhav@pivotree.com
Office Location - Bangalore
Eligibility Criteria -
75% & above throughout 10th, 12th & Graduation
Pass out Batch Academic Year 2023
Major Criteria : Should be good in Computer Science core subjects, Database, Data structure, and coding .Good verbal and written skill.
Note - Shortlisted candidates will be called for Assessment Test followed by inperson interview at Bangalore office.
Candidates who have appeared for Aptitude test in last 6 months cannot be considered.
Please apply for the job over email us on vijeta.padwal@pivotree.com/ vedant.jadhav@pivotree.com
Pivotree
eCommerce, Supply Chain and Data Management Services - Pivotree
Pivotree is your single point of contact for all eCommerce, supply chain, MDM, and cloud hosting needs. Expert design, implementation and support services!
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: Qualcomm
Role: Associate Engineer
Expected CTC: 5.5 - 7.5 LPA
Batch Eligible: 2023 & Before
Website: https://careers.qualcomm.com/careers/job/446696658715?domain=qualcomm.com&source=APPLICANT_SOURCE-6-104
Role: Associate Engineer
Expected CTC: 5.5 - 7.5 LPA
Batch Eligible: 2023 & Before
Website: https://careers.qualcomm.com/careers/job/446696658715?domain=qualcomm.com&source=APPLICANT_SOURCE-6-104
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: Recruit-CRM
Role: UI/UX
Expected CTC: 5 LPA
Batch Eligible: 2024
Website: https://recruitcrm.io/job-apply/?job_id=98
Role: UI/UX
Expected CTC: 5 LPA
Batch Eligible: 2024
Website: https://recruitcrm.io/job-apply/?job_id=98
Recruit CRM
Job Apply - Recruit CRM
Join us at Recruit CRM โ where your career progression story begins!
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐จJOB OPENING UPDATE๐จ
Company โ Heelium
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3803663081
Company โ Genpact
Role โ Data Analyst Python
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3810548762
Company โ Encardio rite Group
Role โ Business Intelligence Executive
Exp. โ 0-3 yrs
Apply Here โ https://www.naukri.com/job-listings-business-intelligence-executive-encardio-rite-group-lucknow-uttar-pradesh-0-to-3-years-180124006254?src=jobsearchDesk&sid=17057277472926218_3&xp=14&
Company โ Lizmotors Mobility Pvt Ltd.
Role โ AI/ML Engineering Intern
Exp. โ Fresher
Apply Here โ https://www.simplyhired.co.in/job/Po82XP_DYPSnKqsmvWZWurpzliWKMR92p3utnMTcThs_cNUjIZx_gw
Company โ Wobot Intelligence Private Limited
Role โ Data Analytics Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/data-analytics-work-from-home-job-internship-at-wobot-intelligence-private-limited1705722978?utm_source=cp_link&referral=web_share
Company โ UM IT Services & Consulting
Role โ Data Science Intern
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3810011634
Company โ Avaari
Role โ Machine Learning Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/machine-learning-part-time-job-internship-at-multiple-locations-in-avaari1705674973?utm_source=cp_link&referral=web_share
Company โ Bhashsms
Role โ Data Analyst Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/data-analyst-internship-in-bangalore-at-jackson-joseph1705650414?utm_source=cp_link&referral=web_share
ALL THE BEST๐
Company โ Heelium
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3803663081
Company โ Genpact
Role โ Data Analyst Python
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3810548762
Company โ Encardio rite Group
Role โ Business Intelligence Executive
Exp. โ 0-3 yrs
Apply Here โ https://www.naukri.com/job-listings-business-intelligence-executive-encardio-rite-group-lucknow-uttar-pradesh-0-to-3-years-180124006254?src=jobsearchDesk&sid=17057277472926218_3&xp=14&
Company โ Lizmotors Mobility Pvt Ltd.
Role โ AI/ML Engineering Intern
Exp. โ Fresher
Apply Here โ https://www.simplyhired.co.in/job/Po82XP_DYPSnKqsmvWZWurpzliWKMR92p3utnMTcThs_cNUjIZx_gw
Company โ Wobot Intelligence Private Limited
Role โ Data Analytics Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/data-analytics-work-from-home-job-internship-at-wobot-intelligence-private-limited1705722978?utm_source=cp_link&referral=web_share
Company โ UM IT Services & Consulting
Role โ Data Science Intern
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3810011634
Company โ Avaari
Role โ Machine Learning Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/machine-learning-part-time-job-internship-at-multiple-locations-in-avaari1705674973?utm_source=cp_link&referral=web_share
Company โ Bhashsms
Role โ Data Analyst Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/detail/data-analyst-internship-in-bangalore-at-jackson-joseph1705650414?utm_source=cp_link&referral=web_share
ALL THE BEST๐
Linkedin
110,000+ Data Analyst jobs in India (6,182 new)
Todayโs top 110,000+ Data Analyst jobs in India. Leverage your professional network, and get hired. New Data Analyst jobs added daily.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Devansh M. on LinkedIn: #jobopportunities #nowhiring #careeropportunities #opigo #techjobs | 39 comments
๐ Exciting Opportunities at OpiGo! ๐
Join our dynamic team! OpiGo is hiring for multiple remote roles:
1. Front End Developer (React Native) - Fullโฆ | 39 comments on LinkedIn
Join our dynamic team! OpiGo is hiring for multiple remote roles:
1. Front End Developer (React Native) - Fullโฆ | 39 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Quadaye is Hiring !!
Role: Python Developer
Expected CTC: 25 to 30 LPA
๐Apply here: https://www.quadeye.com/careers/?gh_jid=5795180002&gh_src=4eab9f2d2
Role: Python Developer
Expected CTC: 25 to 30 LPA
๐Apply here: https://www.quadeye.com/careers/?gh_jid=5795180002&gh_src=4eab9f2d2
Quadeye
Careers - Quadeye
Careers at Quadeye Securities. Join our Team!