이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |