#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll
inline char get_ (){
const int oo=1000005;
static char buf[oo], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, oo, stdin), p1 == p2) ? EOF : *p1 ++;
}
int read_ () {
char c = get_();
int sum = 0;
while(!(c >= '0' && c <= '9')) c = get_();
while(c >= '0' && c <= '9') sum = sum * 10 + (c - '0'), c = get_();
return sum;
}
int n, x[201], l, t[201];
pii pr[201];
int32_t main(){
INIT
cin>>n>>l;
for(int i=1; i<=n; i++){
cin>>x[i];
}
for(int i=1; i<=n; i++){
cin>>t[i];
}
for(int i=1; i<=n; i++){
pr[i]={x[i], t[i]};
}
sort(pr+1, pr+1+n);
pr[n+1]={l, 0};
int res=0;
for(int i=n+1; i>=1; i--){
for(int j=i-1; j>=0; j--){
int cnt=0;
int ac=0;
for(int k=(n); k>=i; k--){
ac+=pr[k+1].ft-pr[k].ft;
if(ac<=pr[k].sc){
cnt++;
}
}
ac+=l-pr[i].ft;
for(int k=1; k<=j; k++){
ac+=pr[k].ft-pr[k-1].ft;
if(ac<=pr[k].sc){
cnt++;
}
}
res=max(res, cnt);
}
}
cout<<res;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |