Submission #569493

#TimeUsernameProblemLanguageResultExecution timeMemory
569493TurkhuuRoad Closures (APIO21_roads)C++17
Compilation error
0 ms0 KiB
#include "roads.h" #include <bits/stdc++.h> std::vector<long long> minimum_closure_costs(int n, std::vector<int> u, std::vector<int> v, std::vector<int> w){ bool subtask1 = true; for(int i = 0; i < n - 1; i++){ if(u[i] != 0){ subtask1 = false; } } if(subtask1){ sort(w.begin(), w.end()); std::vector<long long> ans(n); for(int i = 0; i < n - 1; i++){ ans[n - i - 2] = ans[n - i - 1] + w[i]; } return ans; } bool subtask2 = true; for(int i = 0; i < n - 1; i++){ if(u[i] != i || v[i] != i + 1){ subtask2 = false; } } if(subtask2){ std::assert(false); std::vector<long long> ans(n); ans[0] = accumulate(w.begin(), w.end(), 0LL); std::vector<std::vector<long long>> dp(n, std::vector<long long>(2)); for(int i = 0; i < n - 1; i++){ dp[i][0] = (i == 0 ? 0 : std::min(dp[i - 1][0], dp[i - 1][1])) + w[i]; dp[i][1] = (i == 0 ? 0 : dp[i - 1][0]) + w[i]; } ans[1] = std::min(dp.back()[0], dp.back()[1]); return ans; } return std::vector<long long>(n, 0); }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from roads.cpp:2:
roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:25:10: error: expected unqualified-id before '(' token
   25 |     std::assert(false);
      |          ^~~~~~