Submission #1082748

#TimeUsernameProblemLanguageResultExecution timeMemory
1082748blackslexRoad Closures (APIO21_roads)C++17
0 / 100
22 ms5328 KiB
#include "roads.h" #include <vector> #include<bits/stdc++.h> using namespace std; using ll = long long; const int MxN = 25e4 + 5; ll a[MxN], dp[MxN]; std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { int n = N, m = U.size(); ll res = 0, cur = 0; for (int i = 0; i < m; i++) res += W[i], a[i + 1] = W[i]; vector<ll> ans{res}; for (int i = 1; i <= m; i++) cur = max(cur, dp[i] = max(dp[i - 1], (i - 2 >= 0 ? dp[i - 2] + a[i] : 0))); ans.emplace_back(res - cur); for (int i = 2; i < n; i++) ans.emplace_back(0); return ans; }

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:16:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   16 |   for (int i = 1; i <= m; i++) cur = max(cur, dp[i] = max(dp[i - 1], (i - 2 >= 0 ? dp[i - 2] + a[i] : 0))); ans.emplace_back(res - cur);
      |   ^~~
roads.cpp:16:109: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   16 |   for (int i = 1; i <= m; i++) cur = max(cur, dp[i] = max(dp[i - 1], (i - 2 >= 0 ? dp[i - 2] + a[i] : 0))); ans.emplace_back(res - cur);
      |                                                                                                             ^~~
#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...