Language: C++

#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, T = 0;
	vector<llong> t,v;

	cin >> N;
	t.resize(N+1, 0), v.resize(N+1,0);
	for(int i = 1; i <= N; i++){
		cin >> t[i];
		t[i] += t[i-1];
	}
	for(int i = 1; i <= N; i++)
		cin >> v[i];

	map<double, long double> res;
	for(llong i = N; i >= 1; i--){
		for(double j = t[i]; j >= t[i-1]; j -= 0.5){
			if(res.find(j) == res.end())
				res[j] = inf;
			if(i == N)
				res[j] = min({(double)res[j],(double)t[i]-j, (double)v[i]});
			else if(i == 1)
				res[j] = min({(double)res[j], (double)j, res[j+0.5]+0.5, (double)v[i]});
			else{
				res[j] = min({(double)res[j], res[j+0.5]+0.5, (double)v[i]});
			}
		}
	}

	// for(double i = 0; i < t[N]; i += 0.5)
	// 	cerr << res[i] << endl;

	long double ans = 0.0;
	long double now = 0;
	for(double i = 0; i < t[N]; i += 0.5){
		if(now < res[i+0.5]){
			ans += (now+now+0.5)/4.0;
			now += 0.5;
		}else if(now > res[i+0.5]){
			ans += (now+now-0.5)/4.0;
			now -= 0.5;
		}else{
			ans += now/2.0;
		}
	}

	cout << fixed << setprecision(12) << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:45: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   33 |                                 res[j] = min({(double)res[j], (double)j, res[j+0.5]+0.5, (double)v[i]});
      |                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:33:45: note:   deduced conflicting types for parameter '_Tp' ('double' and 'long double')
   33 |                                 res[j] = min({(double)res[j], (double)j, res[j+0.5]+0.5, (double)v[i]});
      |                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
a.cc:35:45: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   35 |                                 res[j] = min({(double)res[j], res[j+0.5]+0.5, (double)v[i]});
      |                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:35:45: note:   deduced conflicting types for parameter '_Tp' ('double' and 'long double')
   35 |                                 res[j] = min({(double)res[j], res[j+0.5]+0.5, (double)v[i]});
      |                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided