Submission #639928

#TimeUsernameProblemLanguageResultExecution timeMemory
639928StavabCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include "crocodile.h" #include <vector> #include <utility> using namespace std; #define INF 9999999999 vector<vector<pair<int, int>>> tree; vector<long long> times; vector<int> visited; void dfs(int n) { if(visited[n]) return; else visited[n] = 1; if(times[n] == 0) return; vector<long long> temp; for(int i = 0; i < tree[n].size(); i++) { dfs(tree[n][i].first); temp.push_back(times[tree[n][i].first] + tree[n][i].second); } long long minInd, curMin = INF; for(int i = 0; i < temp.size(); i++) { if(curMin > temp[i]) { curMin = temp[i]; minInd = i; } } curMin = INF; for(int i = 0; i < temp.size(); i++) { if(curMin > temp[i] && i != minInd) curMin = temp[i]; } if(curMin >= INF) times[n] = INF: else times[n] = curMin; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { tree.assign(N, vector<pair<int, int>>()); times.assign(N, INF); visited.assign(N, 0); for(int i = 0; i < N - 1; i++) { tree[R[i][0]].push_back(make_pair(R[i][1], L[i])); tree[R[i][1]].push_back(make_pair(R[i][0], L[i])); } for(int i = 0; i < K; i++) times[P[i]] = 0; dfs(0); return (int)times[0]; }

Compilation message (stderr)

crocodile.cpp: In function 'void dfs(int)':
crocodile.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 0; i < tree[n].size(); i++)
      |                    ~~^~~~~~~~~~~~~~~~
crocodile.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i = 0; i < temp.size(); i++)
      |                    ~~^~~~~~~~~~~~~
crocodile.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0; i < temp.size(); i++)
      |                    ~~^~~~~~~~~~~~~
crocodile.cpp:48:23: error: expected ';' before ':' token
   48 |         times[n] = INF:
      |                       ^