제출 #308536

#제출 시각아이디문제언어결과실행 시간메모리
308536kylych03악어의 지하 도시 (IOI11_crocodile)C++14
46 / 100
188 ms262148 KiB
#include "crocodile.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; vector <pair <int, int > > g[1002]; int vis[1002], vis1[1001]; int inf =1e9; int dfs(int v, int p ){ vector <int> vec; if(vis[v]) return 0; for(int i = 0 ; i<g[v].size() ; i++){ int to = g[v][i].first; if(to==p || vis1[p]) continue; vec.push_back ( dfs(to, v) + g[v][i].second); } sort(vec.begin(), vec.end()); vis1[v]=1; if(vec.size() > 1) return vec[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0 ; i < M ;i++){ g[R[i][0]].push_back(make_pair (R[i][1], L[i]) ); g[R[i][1]].push_back( make_pair (R[i][0], L[i])); } for(int i = 0; i < K; i++) vis[P[i]] = 1; int x = dfs(0, -1); return x; } /* 5 4 3 0 1 2 0 2 3 3 2 1 2 4 4 1 3 4 */

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

crocodile.cpp: In function 'int dfs(int, int)':
crocodile.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i  = 0 ; i<g[v].size() ; i++){
      |                      ~^~~~~~~~~~~~
crocodile.cpp:9:18: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     vector <int> vec;
      |                  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...