제출 #229675

#제출 시각아이디문제언어결과실행 시간메모리
229675DavidDamian경주 (Race) (IOI11_race)C++11
컴파일 에러
0 ms0 KiB
//#include "race.h" #include<bits/stdc++.h> using namespace std; ///Subtask 3 ///DFS with buckets typedef long long ll; struct edge { ll to; ll w; }; vector<edge> adjList[200005]; ll k; ll minimum=ll_MAX; void dfs_sub2(ll u,ll p,ll depth,ll path) { if(path==k) minimum=min(minimum,depth); for(edge e: adjList[u]){ ll v=e.to; ll w=e.w; if(p==v) continue; dfs_sub2(v,u,depth+1,path+w); } } ll parent_way[200005]; void fillParent(ll u,ll p) { for(edge e: adjList[u]){ ll v=e.to; ll w=e.w; if(v==p) continue; parent_way[v]=w; fillParent(v,u); } } vector<ll>* bucket[200005]; void dfs(ll u,ll p) { ll leaf=1; for(edge e: adjList[u]){ ll v=e.to; ll w=e.w; if(p==v) continue; leaf=0; dfs(v,u); } bucket[u]=new vector<ll>(101); for(edge e: adjList[u]){ ll v=e.to; ll w=e.w; if(p==v) continue; for(ll i=0;i<k;i++){ ll path_child=(*bucket[v])[i]; ll path=(*bucket[u])[k-i]; if(path_child==0) continue; if(path!=0) minimum=min(minimum,path_child+path); if((*bucket[u])[i]==0) (*bucket[u])[i]=path_child; else (*bucket[u])[i]=min((*bucket[u])[i],path_child); } if((*bucket[v])[k]!=0) minimum=min(minimum,(*bucket[v])[k]); } if(leaf) (*bucket[u])[ parent_way[u] ]=1; if((*bucket[u])[k]!=0) minimum=min(minimum,(*bucket[u])[k]); if(!leaf){ for(ll i=k;i>=1;i--){ if((ll)i+parent_way[u]>k) continue; ll dist=i+parent_way[u]; if((*bucket[u])[i]!=0){ (*bucket[u])[dist]=(*bucket[u])[i]+1; if(dist!=i) (*bucket[u])[i]=0; } } (*bucket[u])[ parent_way[u] ]=1; } } int best_path(ll n, ll K, ll H[][2], ll L[]) { k=K; for(ll i=0;i<n-1;i++){ ll a=H[i][0]; ll b=H[i][1]; ll w=L[i]; adjList[a].push_back({b,w}); adjList[b].push_back({a,w}); } if(n<=1000){ for(ll u=0;u<n;u++){ dfs_sub2(u,-1,0,0); } return (minimum!=ll_MAX)? minimum : -1; } fillParent(0,-1); dfs(0,-1); /*for(ll i=0;i<n;i++){ cout<<i<<":"; for(ll j=0;j<=k;j++){ if((*bucket[i])[j]!=0) cout<<j<<" "<<(*bucket[i])[j]<<endl; } cout<<endl; }*/ return (minimum!=ll_MAX)? minimum : -1; }

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

race.cpp:14:12: error: 'll_MAX' was not declared in this scope
 ll minimum=ll_MAX;
            ^~~~~~
race.cpp:14:12: note: suggested alternative: 'NL_NMAX'
 ll minimum=ll_MAX;
            ^~~~~~
            NL_NMAX
race.cpp: In function 'void dfs(ll, ll)':
race.cpp:42:12: warning: unused variable 'w' [-Wunused-variable]
         ll w=e.w;
            ^
race.cpp:50:12: warning: unused variable 'w' [-Wunused-variable]
         ll w=e.w;
            ^
race.cpp: In function 'int best_path(ll, ll, ll (*)[2], ll*)':
race.cpp:94:26: error: 'll_MAX' was not declared in this scope
         return (minimum!=ll_MAX)? minimum : -1;
                          ^~~~~~
race.cpp:94:26: note: suggested alternative: 'NL_NMAX'
         return (minimum!=ll_MAX)? minimum : -1;
                          ^~~~~~
                          NL_NMAX
race.cpp:105:22: error: 'll_MAX' was not declared in this scope
     return (minimum!=ll_MAX)? minimum : -1;
                      ^~~~~~
race.cpp:105:22: note: suggested alternative: 'NL_NMAX'
     return (minimum!=ll_MAX)? minimum : -1;
                      ^~~~~~
                      NL_NMAX