#include<bits/stdc++.h>
using namespace std;
#define int long long
#define tii tuple<int, int, int>
#define pii pair<int, int>
#define ff first
#define ss second
const int maxn = 2e3 + 5, INF = 0x3f3f3f3f3f3f3f3f;
int X[maxn], T[maxn];
int32_t main(){
int n, L; cin >> n >> L;
for(int i = 1; i <= n; i++) cin >> X[i];
for(int i = 1; i <= n; i++) cin >> T[i];
X[0] = X[n+1] = 0;
int ans = 0;
for(int i = 0; i <= n; i++){
int tans = 0;
for(int j = 1; j <= i; j++){
if(T[j] >= X[j]) tans++;
}
for(int j = n; j > i; j--){
if(T[j] >= L-X[j] + 2*X[i]) tans++;
}
ans = max(ans, tans);
}
for(int i = 0; i <= n; i++){
int tans = 0;
for(int j = n; j > i; j--){
if(T[j] >= L-X[j]) tans++;
}
for(int j = 1; j <= i; j++){
if(T[j] >= X[j] + 2*(L-X[i+1])) tans++;
}
ans = max(ans, tans);
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |