#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
ll n,l;
cin >> n >> l;
vector<ll> x(n),t(n);
for(ll &i : x) cin >> i;
for(ll &i : t) cin >> i;
vector<ll> rx(n),rt(n);
for(ll i = 0;i<n;i++){
rx[i] = l-x[n-1-i];
rt[i] = t[n-1-i];
}
ll ans = 0;
{
ll cur = 0;
for(ll i = 0;i<n;i++) cur += t[i]>=x[i];
ans = max(ans,cur);
}
{
ll cur = 0;
for(ll i = 0;i<n;i++) cur += rt[i]>=rx[i];
ans = max(ans,cur);
}
for(ll i = 0;i<n;i++){
ll w = x[i];
ll cur = 0;
for(ll j = 0;j<=i;j++) cur += t[j]>=x[j];
w*=2;
for(ll j = 0;j+i<n-1;j++) cur += rt[j]>=rx[j]+w;
ans = max(ans,cur);
}
for(ll i = 0;i<n;i++){
ll w = rx[i];
ll cur = 0;
for(ll j = 0;j<=i;j++) cur += rt[j]>=rx[j];
w*=2;
for(ll j = 0;j+i<n-1;j++) cur += t[j]>=x[j]+w;
ans = max(ans,cur);
}
cout << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |