Submission #313355

#TimeUsernameProblemLanguageResultExecution timeMemory
313355sofapudenCollecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, l; cin >> n >> l; vector<int> X(n), T(n); for(auto &x : X)cin >> x; for(auto &t : T)cin >> t; int ans = 0; for(int i = 0; i <= n; ++i){ int cur = 0; int tim = 0; int place = l; for(int j = 1; j <= i; ++j){ tim+=place-X[n-j]; place = X[n-j]; if(tim <= T[n-j])cur++; } tim*=2; place = 0; for(int j = 0; j < n-i; ++j){ tim+=X[j]-place; place = X[j]; if(tim <= T[j])cur++; } ans = max(ans,cur); } for(int i = 0; i <= n; ++i){ int cur = 0; int tim = 0; int place = 0; for(int j = 0; j < i; ++j){ tim+=X[j]-place; place = X[j]; if(tim <= T[j])cur++; } tim*=2; place = l; for(int j = 1; j <= n-i; ++j){ tim+=place-X[n-j]; place = X[n-j]; if(tim <= T[n-j])cur++; } ans = max(ans,cur); } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...