#include <iostream>
#include <map>
using namespace std;
using ll = long long;
int n, l;
ll x[205], t[205];
map<ll, int> dp[205][205];
ll dist(int x1, int x2) {
if (x1 > x2) swap(x1, x2);
return min(x2 - x1, l - x2 + x1)
}
int solve(int i, int j, ll time_passed) {
if (i == j) return 0;
if (dp[i][j].count(time_passed)) return dp[i][j][time_passed];
int cur = i, l = min(i, j), r = max(i, j);
int ans = solve(l + 1, r, dist(x[cur], x[l + 1]) + time_passed) + (dist(x[cur], x[l + 1]) + time_passed <= t[l + 1]);
ans = max(ans, solve(r - 1, l, dist(x[cur], x[r - 1]) + time_passed) + (dist(x[cur], x[r - 1]) + time_passed <= t[r - 1]));
dp[i][j][time_passed] = ans;
return ans;
}
int main() {
cin >> n >> l;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
for (int i = 0; i < n; i++) {
cin >> t[i];
}
cout << solve(0, n - 1, 0) << '\n';
return 0;
}
Compilation message
ho_t3.cpp: In function 'll dist(int, int)':
ho_t3.cpp:13:37: error: expected ';' before '}' token
13 | return min(x2 - x1, l - x2 + x1)
| ^
| ;
14 | }
| ~