# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756726 | vioalbert | Cyberland (APIO23_cyberland) | C++17 | 1366 ms | 13352 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 "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) __VA_ARGS__;
#else
#define debug(...)
#endif
const double INF = 1e15;
double solve(int N, int M, int K, int H, vector<int> x,
vector<int> y, vector<int> c, vector<int> arr) {
vector adj(N, vector<pair<int, int>>());
for(int i = 0; i < M; i++) {
if(x[i] != H) adj[x[i]].emplace_back(y[i], c[i]);
if(y[i] != H) adj[y[i]].emplace_back(x[i], c[i]);
}
vector<int> mark(N, 0);
const auto connected = [&](const auto &self, int u, int target) -> bool {
if(u == target) return true;
mark[u] = 1;
for(auto [v, c] : adj[u]) if(!mark[v]) {
if(self(self, v, target)) return true;
}
return false;
};
if(!connected(connected, 0, H)) {
return -1.0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |