//
// main.cpp
// IntensiveCamp 1 2025
//
// Created by Ali AlSalman on 24/01/2025.
//
#include <bits/stdc++.h>
template<typename T>
using vec = std::vector<T>;
using namespace std;
void solve() {
int n, m;
cin>>n>>m;
if (m == n - 1) {
pair<int, int> arr[m];
int s = 0, t = 0;
while (m--) {
int a, b, c, d;
cin>>a>>b>>c>>d; s += c; t += d;
arr[m] = {b, a};
}
cout<<s<<" "<<t<<endl;
for (auto [a, b] : arr) cout<<a<<" "<<b<<endl;
exit(0);
}
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int t = 1;
// cin>>t;
while (t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |