Submission #244880

#TimeUsernameProblemLanguageResultExecution timeMemory
244880vioalbertCollecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll N = 205;
ll n, l;
ll cl[N], ccl[N], t[N];

void read() {
	cin >> n >> l;
	for(int i = 0; i < n; i++) {
		cin >> cl[i];
		ccl[i] = l - cl[i];
	}
	for(int i = 0; i < n; i++)
		cin >> t[i];
}

void solve() {
	ll ans = 0, dist = 0, dist2 = 0, cnt = 0;
	for(int i = 0; i < n; i++) {
		//go cl first
		dist = dist2 = cnt = 0;
		for(int j = 0; j <= i; j++) {
			dist = cl[j];
			if(t[j] >= dist) cnt++;
		}
		if(i < n-1) {
			for(int j = n-1; j > i; j--) {
				dist2 = ccl[j];
				if(t[j] >= 2*dist + dist2) cnt++;
			}
		}
		ans = max(ans, cnt);
		//go ccl first
		dist = dist2 = cnt = 0;
		for(int j = n-1; j >= i; j--) {
			dist2 = ccl[j];
			if(t[j] >= dist2) cnt++;
		}
		if(i > 0) {
			for(int j = 0; j < i; j++) {
				dist = cl[j];
				if(t[j] >= 2*dist2 + dist) cnt++;
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans << '\n';
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	read();
	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...