Submission #1024333

#TimeUsernameProblemLanguageResultExecution timeMemory
1024333Ahmed_SolymanStations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "stations.h" typedef long long ll; vector<vector<int>>adj; int mark=0; vector<int>in; vector<int> label(int n, int k, vector<int> u, vector<int> v){ mark=0; adj.resize(n); in.resize(n); for(int i=0;i<n-1;i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } int mark=0; auto dfs=[&](auto &self,int i,int par){ in[i]=mark++; for(auto x:adj[i]){ if(x!=par)dfs(dfs,x,i); } return void(); }; for(int i=0;i<n;i++){ if(adj[i].size()==1){ dfs(dfs,i,i);break; } } return in; } int find_next_station(int s, int t,vector<int> c){ int p=0; for(auto i:c){ if(i<=s){ p=i;continue; } if(i<=t){ return i; } } return p; }

Compilation message (stderr)

stations.cpp: In lambda function:
stations.cpp:21:23: error: use of 'dfs' before deduction of 'auto'
   21 |             if(x!=par)dfs(dfs,x,i);
      |                       ^~~
stations.cpp:21:27: error: use of 'dfs' before deduction of 'auto'
   21 |             if(x!=par)dfs(dfs,x,i);
      |                           ^~~