Submission #849092

#TimeUsernameProblemLanguageResultExecution timeMemory
849092adhityamvCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N=100000; vector<pair<int,ll>> edges[N]; bool visited[N]={}; double ans=0; void dfs(int u,int h){ if(u==h) return; for(auto v:edges[u]){ if(!visited[v.first]){ visited[v.first]=true; ans+=v.second; dfs(v,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){ 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(); } return ans; }

Compilation message (stderr)

cyberland.cpp: In function 'void dfs(int, int)':
cyberland.cpp:14:17: error: cannot convert 'std::pair<int, long long int>' to 'int'
   14 |             dfs(v,h);
      |                 ^
      |                 |
      |                 std::pair<int, long long int>
cyberland.cpp:8:14: note:   initializing argument 1 of 'void dfs(int, int)'
    8 | void dfs(int u,int h){
      |          ~~~~^