제출 #170693

#제출 시각아이디문제언어결과실행 시간메모리
170693juggernautEvacuation plan (IZhO18_plan)C++14
0 / 100
4006 ms16408 KiB
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; int n,m,i,x,y,z,mn[100001],vis[100001],e,res; vector<vector<pair<int,int>>>g(100001); void update(int v){ for(auto to:g[v]){ if(mn[v]+to.second<mn[to.first]){ mn[to.first]=mn[v]+to.second; update(to.first); } } } void dfs(int v){ if(vis[v])return; vis[v]=1; res=min(res,mn[v]); if(v==y)return; for(auto to:g[v])dfs(to.first); vis[v]=0; } main(){ scanf("%lld%lld",&n,&m); for(i=1;i<=n;i++)mn[i]=1e15; while(m--){ scanf("%lld%lld%lld",&x,&y,&z); g[x].push_back({y,z}); g[y].push_back({x,z}); } scanf("%lld",&m); while(m--){ scanf("%lld",&x); mn[x]=0; update(x); } scanf("%lld",&m); while(m--){ scanf("%lld%lld",&x,&y); for(i=1;i<=n;i++)vis[i]=0; e=1; res=1e15; dfs(e); printf("%lld\n",res); } }

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

plan.cpp:23:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
plan.cpp: In function 'int main()':
plan.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~~~~
plan.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld",&x,&y,&z);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
plan.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&m);
     ~~~~~^~~~~~~~~~~
plan.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&x);
         ~~~~~^~~~~~~~~~~
plan.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&m);
     ~~~~~^~~~~~~~~~~
plan.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&x,&y);
         ~~~~~^~~~~~~~~~~~~~~~~~
#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...