제출 #1024342

#제출 시각아이디문제언어결과실행 시간메모리
1024342Ahmed_Solyman기지국 (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "stations.h" typedef long long ll; vector<vector<int>>adj; vector<int>ret; int mark=0; void dfs(int node,int par){ ret[node]=mark++;; for(auto i:adj[node]){ if(i!=par)dfs(i,node); } } vector<int> label(int n, int k, vector<int> u, vector<int> v){ ret.resize(n); adj.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 root=0; for(int i=0;i<n;i++){ if(adj[i].size()==1)root=i; } dfs(i); return ret; } int find_next_station(int s, int t,vector<int> c){ if((int)c.size()==1)return c[0]; else if(t>s)return t+1; else return t-1; }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:26:9: error: 'i' was not declared in this scope
   26 |     dfs(i);
      |         ^