Submission #1150975

#TimeUsernameProblemLanguageResultExecution timeMemory
1150975pinbuCollecting Stamps 3 (JOI20_ho_t3)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 205; int n, l, x[N], t[N]; void solve(void) { cin >> n >> l; for (int i = 1; i <= n; i++) cin >> x[i]; for (int i = 1; i <= n; i++) cin >> t[i]; int ans = 0, res = 0; // I. CW res = 0; for (int i = 1; i <= n; i++) { res += x[i] <= t[i]; int res2 = res; for (int j = n; j > i; j--) { res2 += (2 * x[i] + l - x[j]) <= t[j]; } ans = max(ans, res2); } ans = max(ans, res); // II. CCW; res = 0; for (int i = n; i; i--) { res += (l - x[i]) <= t[i]; int res2 = res; for (int j = 1; j < i; j++) { res2 += (2 * (l - x[i]) + x[j]) <= t[j]; } ans = max(ans, res2); } ans = max(ans, res); cout << ans; } signed main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); int T = 1;// cin >> T; while (T--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...