Submission #221877

#TimeUsernameProblemLanguageResultExecution timeMemory
221877davooddkareshkiCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
5 ms384 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define int long long const int maxn = 1e6+10; const ll inf = 1e18+10; int n, L; int x[maxn], t[maxn]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>> n >> L; for(int i = 1; i <= n; i++) cin>> x[i]; for(int i = 1; i <= n; i++) cin>> t[i]; ll ans = 0; for(int l = 0; l <= n; l++) for(int R = l+1; R <= n+1; R++) { int r = R; int A = 0, tim = 0; for(int i = 1; i <= l; i++) if(tim + x[i] <= t[i]) A++; ans = max(ans,A); tim = 2*x[l]; for(int i = n; i >= r; i--) if(tim + (L-x[i]) <= t[i]) A++; ans = max(ans,A); // cout<< l <<" "<< r <<" "<< A <<"\n"; tim = 0, A = 0; for(int i = n; i >= r; i--) if(tim + (L-x[i]) <= t[i]) A++; ans = max(ans,A); tim = 2*(L-x[r]); if(r == n+1) tim = 0; for(int i = 1; i <= l; i++) if(tim + x[i] <= t[i]) A++; ans = max(ans,A); // cout<< l <<" "<< r <<" "<< A <<"\n"; } cout<< ans; } /* 6 25 3 4 7 17 21 23 11 7 17 10 8 10 10 87 9 23 33 38 42 44 45 62 67 78 15 91 7 27 31 53 12 91 89 46 4 19 3 7 12 14 2 0 5 4 5 20 4 5 8 13 17 18 23 15 7 10 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...