Submission #864097

#TimeUsernameProblemLanguageResultExecution timeMemory
864097Ice_manTruck Driver (IOI23_deliveries)C++17
Compilation error
0 ms0 KiB
#include <deliveries.h> #include <iostream> #include <vector> #define maxn 100005 #define maxq 300005 #define INF 1000000010 #define endl '\n' using namespace std; int n; int t[maxn]; long long c[maxn]; vector <pair <int , int> > v[maxn]; long long ans; long long pom; void dfs(int node , int parent = -1) { c[node] = t[node]; for(int i = 0; i < v[node].size(); i++) { if(v[node][i].first == parent) continue; dfs(v[node][i].first , node); ans += v[node][i].second * min(c[v[node][i].first] , pom - c[v[node][i].first]); c[node] += c[v[node][i].first]; } } void innit(int N , vector <int> U , vector <int> V, vector <int> W, vector <int> T) { n = N; for(int i = 0; i < U.size(); i++) v[U[i]].push_back({V[i] , W[i]}); for(int i = 0; i < V.size(); i++) v[V[i]].push_back({U[i] , W[i]}); for(int i = 0; i < n; i++) pom += t[i]; for(int i = 0; i < n; i++) t[i] = T[i]; } long long max_time(int S , int X) { pom -= t[S]; t[S] = X; pom += t[S]; ans = 0; dfs(0); return ans; }

Compilation message (stderr)

deliveries.cpp: In function 'void dfs(int, int)':
deliveries.cpp:26: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]
   26 |     for(int i = 0; i < v[node].size(); i++)
      |                    ~~^~~~~~~~~~~~~~~~
deliveries.cpp: In function 'void innit(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
deliveries.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0; i < U.size(); i++) v[U[i]].push_back({V[i] , W[i]});
      |                    ~~^~~~~~~~~~
deliveries.cpp:42:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i = 0; i < V.size(); i++) v[V[i]].push_back({U[i] , W[i]});
      |                    ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccYJPu3q.o: in function `main':
grader.cpp:(.text.startup+0x3f6): undefined reference to `init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status