제출 #412119

#제출 시각아이디문제언어결과실행 시간메모리
412119A_DCrocodile's Underground City (IOI11_crocodile)C++14
89 / 100
331 ms35452 KiB
#include "crocodile.h" #include <bits/stdc++.h> #define LL long long #define ii pair<LL,LL> #define F first #define S second using namespace std; const int NN=1e3+100; const int INF=1e18; vector<ii> g[NN]; LL dp[NN]; vector<LL> vec; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i=0;i<N;i++)dp[i]=INF; for(int i=0;i<K;i++)dp[P[i]]=0; for(int i=0;i<M;i++){ LL u=R[i][0]; LL v=R[i][1]; LL w=L[i]; g[u].push_back({v,w}); g[v].push_back({u,w}); // cout<<u<<" "<<v<<" "<<w<<endl; } int h=N; while(h--){ for(int i=0;i<N;i++){ vec.clear(); for(auto x:g[i]){ vec.push_back(dp[x.F]+x.S); } sort(vec.begin(),vec.end()); if(vec.size()>1){ dp[i]=min(dp[i],vec[1]); } } } LL ans=dp[0]; // for(int i=0;i<N;i++)cout<<dp[i]<<" ";cout<<endl; return ans; } /* 5 4 3 0 1 2 0 2 3 3 2 1 2 4 4 1 3 4 5 7 2 0 2 4 0 3 3 3 2 2 2 1 10 0 1 100 0 4 7 3 4 9 1 3 */

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

crocodile.cpp:9:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    9 | const int INF=1e18;
      |               ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...