제출 #1024367

#제출 시각아이디문제언어결과실행 시간메모리
1024367Ahmed_Solyman기지국 (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<vector<int>>adj; vector<int>l,r; int mark=0; void dfs(int node,int par){ l[node]=mark++; for(auto i:adj[node]) if(i!=par)dfs(i,node); r[node]=mark-1; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ mark=0; l=r=vector<int>(n); adj=vector<vector<int>>(n); for(int i=0;i<n-1;i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0,0); vector<int>ret; for(int i=0;i<n;i++)ret.push_back(l[i]*1000+r[i]); return ret; } bool is_anc(int u,int v){ int g=v%1000,p=v/1000; assert(g>=p && (p<in || g>=in)); int in=u/1000,out=u%1000; if(p>=in && g<=out)return 1; else return 0; } int find_next_station(int s, int t,vector<int> c){ int root=0; for(auto i:c){ if(is_anc(i,s))root=i; else if(is_anc(i,t))return i; } return root; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from stations.cpp:1:
stations.cpp: In function 'bool is_anc(int, int)':
stations.cpp:30:22: error: 'in' was not declared in this scope; did you mean 'yn'?
   30 |    assert(g>=p && (p<in || g>=in));
      |                      ^~
stations.cpp:31:19: warning: control reaches end of non-void function [-Wreturn-type]
   31 |     int in=u/1000,out=u%1000;
      |                   ^~~