Submission #737312

#TimeUsernameProblemLanguageResultExecution timeMemory
737312keisuke6Road Closures (APIO21_roads)C++14
0 / 100
31 ms4372 KiB
#include "roads.h" #include <vector> #include <algorithm> using namespace std; typedef long long ll; std::vector<ll> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { vector<ll> A = {}; ll a = 0; for(int i=0;i<W.size();i++) a += W[i]; A.push_back(a); vector<ll> dp(N,1e18); dp[0] = 0; for(int i=0;i<N-1;i++){ dp[i+1] = min(dp[i+1],dp[i]+W[i]); if(i+2 < N) dp[i+2] = min(dp[i+2],dp[i]+W[i]); } A.push_back(min(dp[N-2],dp[N-1])); while(A.size() != N) A.push_back(0); return A; }

Compilation message (stderr)

roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:10:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |   for(int i=0;i<W.size();i++) a += W[i];
      |               ~^~~~~~~~~
roads.cpp:19:18: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |   while(A.size() != N) A.push_back(0);
      |         ~~~~~~~~~^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...