Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int n;
int time[10000];
int dp[10000][5000];//[i][j] = i????????\?????§j??¬??????????°?

// d????????\?????§a?????????????°????
int dfs(int d, int a) {
	if (a == 0) return 0;
	if (a < 0 || d == n - 1) return INF;
	if (dp[d][a] != INF) return dp[d][a];
	
	int res = INF;
	FOR(i, d + 1, n) {
		res = min(res, time[i - 1] + dfs(i, a - (i - d)));
		res = min(res, time[i - 1] + dfs(i, a)); 
	}
	return dp[d][a] = res;
}

int main() {
	cin >> n;
	REP(i, n - 1) scanf("%d", &time[i]);
	
	fill(dp[0], dp[n], INF);
	cout << dfs(0, n / 2) << endl;
	return 0;
}

Compiler output:
a.cc:12:15: error: 'int time [10000]' redeclared as different kind of entity
   12 | int time[10000];
      |               ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:23:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   23 |                 res = min(res, time[i - 1] + dfs(i, a - (i - d)));
      |                                          ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   23 |                 res = min(res, time[i - 1] + dfs(i, a - (i - d)));
      |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:23:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
   23 |                 res = min(res, time[i - 1] + dfs(i, a - (i - d)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:23:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
   23 |                 res = min(res, time[i - 1] + dfs(i, a - (i - d)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:23:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |                 res = min(res, time[i - 1] + dfs(i, a - (i - d)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                 res = min(res, time[i - 1] + dfs(i, a));
      |                                          ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                 res = min(res, time[i - 1] + dfs(i, a));
      |                                ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:24:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
   24 |                 res = min(res, time[i - 1] + dfs(i, a));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:24:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
   24 |                 res = min(res, time[i - 1] + dfs(i, a));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:24:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |                 res = min(res, time[i - 1] + dfs(i, a));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |         REP(i, n - 1) scanf("%d", &time[i]);
      |                                          ^