Submission #849101

# Submission time Handle Problem Language Result Execution time Memory
849101 2023-09-14T05:30:58 Z adhityamv Cyberland (APIO23_cyberland) C++17
8 / 100
23 ms 10832 KB
#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
#define ll long long
const int N=100000;
vector<pair<int,ll>> edges[N];
bool visited[N]={};
double ans=0;
double fans;
void dfs(int u,int h){
    if(u==h){
        fans=ans;
    }
    for(auto v:edges[u]){
        if(!visited[v.first]){
            visited[v.first]=true;
            ans+=v.second;
            dfs(v.first,h);
            ans-=v.second;
        }
    }
}
double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> a){
    ans=0;
    fans=0;
    for(int i=0;i<m;i++){
        edges[x[i]].push_back(make_pair(y[i],(ll) c[i]));
        edges[y[i]].push_back(make_pair(x[i],(ll) c[i]));
    }
    visited[0]=true;
    dfs(0,h);
    for(int i=0;i<n;i++){
        edges[i].clear();
        visited[i]=false;
    }
    return fans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2904 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 2908 KB Correct.
2 Correct 17 ms 3928 KB Correct.
3 Correct 19 ms 3788 KB Correct.
4 Correct 16 ms 3928 KB Correct.
5 Correct 16 ms 3928 KB Correct.
6 Correct 14 ms 4440 KB Correct.
7 Correct 18 ms 4696 KB Correct.
8 Correct 11 ms 4864 KB Correct.
9 Correct 16 ms 3672 KB Correct.
10 Correct 16 ms 3672 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 2904 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 10832 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 2904 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 3160 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 2904 KB Wrong Answer.
2 Halted 0 ms 0 KB -