제출 #926227

#제출 시각아이디문제언어결과실행 시간메모리
926227velislavgarkov기지국 (IOI20_stations)C++14
0 / 100
3029 ms2097152 KiB
#include "stations.h" #include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAXN=1e3+10; vector <int> ver[MAXN]; vector <int> in; int br; void dfs(int x, int par) { in[x]=br; br++; for (auto i:ver[x]) { if (i==par) continue; dfs(i,x); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { in.resize(n); br=0; for (int i=0;i<n-1;i++) { ver[u[i]].push_back(v[i]); ver[v[i]].push_back(u[i]); } dfs(0,-1); return in; } int find_next_station(int s, int t, vector<int> c) { if (s>t) return c[0]; int ans; for (auto i:c) { if (t>c[i]) ans=c[i]; } return ans; }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:31:6: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |  int ans;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...