제출 #1150972

#제출 시각아이디문제언어결과실행 시간메모리
1150972pinbuCollecting Stamps 3 (JOI20_ho_t3)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
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, cur = 0, res = 0;
	// I. CW
	cur = res = 0;
	for (int i = 1; i <= n; i++) {
		cur += x[i];
		res += cur <= t[i];
		int cur2 = 2 * cur, res2 = res;
		for (int j = n; j > i; j--) {
			res2 += (cur2 + 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 cur2 = 2 * (l - x[i]), res2 = res;
		for (int j = 1; j < i; j++) {
			res2 += (cur2 + 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...