Submission #849091

# Submission time Handle Problem Language Result Execution time Memory
849091 2023-09-14T05:17:07 Z adhityamv Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#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);
    fo(int i=0;i<n;i++){
        edges[i].clear();
    }
    return ans;
}

Compilation message

cyberland.cpp:8:1: error: expected ',' or ';' before 'void'
    8 | void dfs(int u,int h){
      | ^~~~
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:25:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   25 |     dfs(0,h);
      |     ^~~
      |     ffs
cyberland.cpp:26:8: error: expected primary-expression before 'int'
   26 |     fo(int i=0;i<n;i++){
      |        ^~~
cyberland.cpp:26:16: error: 'i' was not declared in this scope
   26 |     fo(int i=0;i<n;i++){
      |                ^