#include<bits/stdc++.h>
using namespace std;
#define oo 1000000000000000
#define f first
#define s second
vector<int> up;
int Find(int x){
if(up[x] < 0)return x;
else{
up[x]=Find(up[x]);
return up[x];
}
}
void Union(int a, int b){
a = Find(a);
b = Find(b);
up[b]=a;
}
long long n, m;
vector<pair<pair<int, int>,pair<long long, long long>>> E;
vector<pair<int, int>> ans;
long long tim = 0, money = 0, currpos, best;
bool cmp(pair<pair<int, int>,pair<long long, long long>> a, pair<pair<int, int>,pair<long long, long long>> b){
return a.s.f*b.s.s < a.s.s*b.s.f;
}
pair<ll, ll>
int main(){
cin >> n >> m;
E.resize(m);
up.assign(n, -1);
for(int i = 0; i < m; i++){
cin >> E[i].f.f >> E[i].f.s >> E[i].s.f >> E[i].s.s;
}
sort(E.begin(), E.end(), cmp);
for(int j = 0; j < n-1; j++){
best = oo;
for(int i = 0; i < m; i++){
if(Find(E[i].f.f) == Find(E[i].f.s))continue;
else{
if(tim*E[i].s.s + money*E[i].s.f + E[i].s.s*E[i].s.f < best){
best = tim*E[i].s.s + money*E[i].s.f + E[i].s.s*E[i].s.f;
currpos = i;
}
}
}
tim += E[currpos].s.f;
money += E[currpos].s.s;
Union(E[currpos].f.f, E[currpos].f.s);
ans.push_back(E[currpos].f);
}
cout << tim << " " << money << endl;
for(int i =0; i < ans.size(); i++){
cout << ans[i].f << " " << ans[i].s << endl;
}
}
Compilation message
timeismoney.cpp:33:6: error: 'll' was not declared in this scope
33 | pair<ll, ll>
| ^~
timeismoney.cpp:33:10: error: 'll' was not declared in this scope
33 | pair<ll, ll>
| ^~
timeismoney.cpp:33:12: error: template argument 1 is invalid
33 | pair<ll, ll>
| ^
timeismoney.cpp:33:12: error: template argument 2 is invalid
timeismoney.cpp:33:1: error: two or more data types in declaration of 'main'
33 | pair<ll, ll>
| ^~~~~~~~~~~~