# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1012523 | vjudge1 | timeismoney (balkan11_timeismoney) | C++17 | 3 ms | 908 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll;
#define MEMSET_MAX 0x7f
#define testcases \
int test_amount; \
cin >> test_amount; \
while (test_amount--)
const ll inf = 1e16; const int mod = 1e9+7;
ll n, m, sum, x, y, t, c;
bool visited[203];
vector<pair<ll, pll>> e;
vector<pll> res;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> x >> y >> t >> c;
e.push_back({t, {x, y}});
}
sort(e.begin(), e.end());
for (auto i : e) {
if (visited[i.second.first] == 0 || visited[i.second.second] == 0) {
sum += i.first;
visited[i.second.first] = 1; visited[i.second.second] = 1;
res.push_back({i.second.first, i.second.second});
}
}
cout << sum << " " << sum << "\n";
for (auto i : res) cout << i.first << " " << i.second << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |