// TESTING GPT
#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int n, l, cnt, res, x[N], t[N];
bool f[N][N * 2];
int main() {
cin >> n >> l;
for (int i = 1; i <= n; i++) cin >> x[i];
for (int i = 1; i <= n; i++) cin >> t[i];
memset(f, false, sizeof f);
f[0][0] = true;
for (int i = 1; i <= n; i++)
for (int j = 0; j < i; j++)
for (int k = 0; k <= 2 * n; k++)
if (f[j][k]) {
int dis1 = x[i] - x[j], dis2 = l - dis1;
int time = min(dis1, dis2) + (k + i - j - 1);
if (time <= t[i]) f[i][time] = true;
}
for (int i = 1; i <= 2 * n; i++)
if (f[n][i]) res = i;
cout << res << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |