| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 567521 | Stickfish | 자매 도시 (APIO20_swap) | C++17 | 109 ms | 11960 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 "swap.h"
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 1e5 + 123;
int n;
vector<pair<int, int>> edg[MAXN];
void init(int N, int m, vector<int> U, vector<int> V, vector<int> W) {
n = N;
vector<pair<int, pair<int, int>>> edg_weight(m);
for (int i = 0; i < m; ++i) {
edg_weight[i] = {W[i], {U[i], V[i]}};
}
sort(edg_weight.begin(), edg_weight.end());
for (auto [w, e] : edg_weight) {
auto [u, v] = e;
edg[u].push_back({v, w});
edg[v].push_back({u, w});
}
}
int getMinimumFuelCapacity(int X, int Y) {
if (edg[0].size() < n - 1)
return -1;
if (edg[0].size() < 3)
return -1;
if (X == 0) {
return max(edg[0][2].second, edg[Y][0].second);
}
if (Y == 0)
return getMinimumFuelCapacity(Y, X);
return max({edg[0][2].second, edg[X][0].second, edg[Y][0].second});
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
