Submission #221874

#TimeUsernameProblemLanguageResultExecution timeMemory
221874davooddkareshkiCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
4 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 = 5e5+10; const ll inf = 1e18+10; int n, L; int x[maxn], t[maxn]; signed main() { 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); A = 0, 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); tim = 0; for(int i = n; i >= r; i--) if(tim + (L-x[i]) <= t[i]) A++; ans = max(ans,A); } cout<< ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...