# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
981824 | FZ_Melo | Cyberland (APIO23_cyberland) | C++17 | 1223 ms | 2097152 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;
struct ari{
int node;
double cnt;
};
vector<vector<ari>> adj;
int state[100000];
int n, m, k, fin;
double ans;
void dfs(int node, double cnt, int ant){
if(node==fin){
ans=min(ans, cnt);
return;
}
for(auto h: adj[node]){
if(h.node==ant)
continue;
dfs(h.node, cnt+h.cnt, node);
}
}
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
n=N; m=M; k=K; fin=H;
adj.clear();
adj.resize(n);
ans=(1<<30);
for(int i=0; i<m; i++){
adj[x[i]].push_back({y[i], c[i]});
adj[y[i]].push_back({x[i], c[i]});
}
for(int i=0; i<n; i++)
state[i]=arr[i];
dfs(0, 0, 0);
if(ans==(1<<30))
ans=-1;
return ans;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |