#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
int n, l, A[205], B[205];
int mx = 0;
void solve(){
cin >> n >> l;
for(int i=1;i<=n;i++)cin >> A[i];
for(int i=1;i<=n;i++)cin >> B[i];
int cur = 0;
for(int i=1;i<=n;i++){
if(B[i] >= A[i])cur++;
}
mx = max(mx, cur);
cur = 0;
for(int i=n;i>=1;i--){
if(B[i] >= l - A[i])cur++;
}
mx = max(mx, cur);
cur = 0;
for(int i=1;i<=n;i++){
if(B[i] >= A[i])cur++;
int t = 2 * A[i];
int cur2 = 0;
for(int j=n;j>i;j--){
if(B[j] >= l - A[j] + t)cur2++;
}
mx = max(mx, cur + cur2);
}
cur = 0;
for(int i=n;i>=1;i--){
int cur2 = 0;
if(B[i] >= l - A[i])cur++;
int t = 2 * (l - A[i]);
for(int j=1;j<i;j++){
if(B[j] >= A[j] + t)cur2++;
}
mx = max(mx, cur + cur2);
}
cout << mx;
}
main(){
ios::sync_with_stdio(0);cin.tie(0);
int tc = 1;
//cin >> tc;
for(int tc1=1;tc1<=tc;tc1++){
// cout << "Case #" << tc1 << ": ";
solve();
}
}
Compilation message
ho_t3.cpp:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
54 | main(){
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |