#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,L;
cin>>n>>L;
int x[n];
int t[n];
for(int i=0;i<n;i++) cin>>x[i];
for(int i=0;i<n;i++) cin>>t[i];
int mans = 0;
for(int i=0;i<n;i++){
int ans = 0;
for(int r=0;r<=i;r++){
if(t[r]-x[r]>=0) ans++;
}
for(int l=n-1;l>=i+1;l--){
if(t[l]-L+x[l]>=2*x[i]) ans++;
}
mans = max(ans,mans);
}
for(int i=n-1;i>=0;i--){
int ans = 0;
for(int r = n-1;r>=i;r--){
if(t[r]-L+x[r]>=0) ans++;
}
for(int l=0;l<i;l++){
if(t[l]-x[l]>=2*(L-x[i])) ans++;
}
mans = max(ans,mans);
}
cout<<mans<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |