求加团:
https://www.luogu.com.cn/team/90259#main
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
unsigned long long ans, s, L, h[MAXN], a[MAXN];
int n;
bool check(unsigned long long x)
{
unsigned long long sum = 0;
for(int i = 1; i <= n; i++)
{
unsigned long long c = h[i] + a[i] * x;
if(c >= L) sum += c;
}
return sum >= s;
}
int main()
{
cin >> n >> s >> L;
for(int i = 1; i <= n; i++) cin >> h[i];
for(int i = 1; i <= n; i++) cin >> a[i];
if(s == 0)
{
cout << 0;
return 0;
}
unsigned long long l = 0, r = 1e18;
while(l <= r)
{
unsigned long long mid = (l + r) >> 1;
if(check(mid))
{
ans = mid;
r = mid - 1;
}
else l = mid + 1;
}
cout << ans;
return 0;
}