Submission #915013

#TimeUsernameProblemLanguageResultExecution timeMemory
915013happypotatoCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
1 ms500 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n, l; cin >> n >> l; int x[n]; for (int i = 0; i < n; i++) cin >> x[i]; int t[n]; for (int i = 0; i < n; i++) cin >> t[i]; int ans = 0; for (int sl = 0; sl <= n; sl++) { for (int sr = 0; sl + sr <= n; sr++) { int cost; int cur1 = 0; cost = (sl == 0 ? 0 : x[sl - 1]) * 2; for (int i = 0; i < sl; i++) cur1 += (x[i] <= t[i]); for (int i = n - 1; i >= n - sr; i--) cur1 += (cost + (l - x[i]) <= t[i]); int cur2 = 0; cost = (sr == 0 ? 0 : x[n - sr]) * 2; for (int i = n - 1; i >= n - sr; i--) cur2 += ((l - x[i]) <= t[i]); for (int i = 0; i < sl; i++) cur2 += ((cost + x[i]) <= t[i]); ans = max(ans, max(cur1, cur2)); } } 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...