Language: C++

#include <cstdio>
#include <algorithm>
 
double n;
double t[102];
double v[101];
double a[20100];
double b[20100];
double s;
float ans;
 
int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; ++i){
		scanf("%d", &t[i]);
		s += t[i];
		t[i] += t[i-1];
	}
	++t[n+1];
	t[n+1] += t[n];
//	for(int i=0; i<=n+1; ++i) printf("%d\t", t[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		scanf("%d", &v[i]);
		for(int j=t[i-1]; j<t[i]; ++j) b[j] = v[i];
	}
	for(int i=0; i<=s; ++i) a[i] = std::min(i, s-i);
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		for(int j=t[i-1]; j<=t[i]; ++j) a[j] = std::min(a[j], v[i]);
		for(int j=t[i-1]; j>=0; --j) a[j] = std::min(a[j], v[i]+t[i-1]-j);
		for(int j=t[i]; j<=s; ++j) a[j] = std::min(a[j], v[i]+j-t[i]);
	}
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<s; ++i) ans += (float)a[i];
	for(int i=1; i+3<s; ++i){
		if(a[i]+1==a[i+1] && a[i+1]==a[i+2] && a[i+2]-1==a[i+3] && b[i+1]>a[i+1] && b[i+2]>a[i+2])
			ans += 0.25;
	}
	printf("%.2f\n", ans);
//	for(int i=1; i<s; ++i) printf("%d %d\n", a[i], b[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: invalid types 'double [102][double]' for array subscript
   19 |         ++t[n+1];
      |            ^
a.cc:20:10: error: invalid types 'double [102][double]' for array subscript
   20 |         t[n+1] += t[n];
      |          ^
a.cc:20:20: error: invalid types 'double [102][double]' for array subscript
   20 |         t[n+1] += t[n];
      |                    ^
a.cc:27:48: error: no matching function for call to 'min(int&, double)'
   27 |         for(int i=0; i<=s; ++i) a[i] = std::min(i, s-i);
      |                                        ~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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:27:48: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   27 |         for(int i=0; i<=s; ++i) a[i] = std::min(i, s-i);
      |                                        ~~~~~~~~^~~~~~~~
/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:
/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:27:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |         for(int i=0; i<=s; ++i) a[i] = std::min(i, s-i);
      |                                        ~~~~~~~~^~~~~~~~