Submission #738488

#TimeUsernameProblemLanguageResultExecution timeMemory
738488MODDIK blocks (IZhO14_blocks)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair<long long, long long> pll; typedef pair<int,int> pii; typedef vector<long long> vl; typedef vector<int> vi; int n, k; vl arr; pll dp[100100][101]; int main(){ cin>>n>>k; arr.resize(n); for(int i = 0; i < n; i++) cin>>arr[i]; build(1, 0, n-1); dp[0][1] = mp(0, arr[0]); dp[0][2] = mp(arr[0], 0); for(int i = 1; i < n; i++){ for(int block = 1; block <= k; block++){ dp[i][block] = mp(dp[i-1][block].first, max(dp[i-1][block].second, arr[i])); if(block -1 >= 1) { if(dp[i][block].first > dp[i-1][block-1].first + dp[i-1][block-1].second){ dp[i][block] = mp(dp[i-1][block-1].first + dp[i-1][block-1].second, arr[i]); } } } } cout<<dp[n-1][k].first+dp[n-1][k].second<<endl; return 0; }

Compilation message (stderr)

blocks.cpp: In function 'int main()':
blocks.cpp:18:2: error: 'build' was not declared in this scope
   18 |  build(1, 0, n-1);
      |  ^~~~~