我的代码 #1 和 #16 WA 了
求调
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int N = 2e5+10;
int n, S, L, H[N], A[N];
bool check(int x) {
int ans = 0;
for(int i = 1; i <= n; i++) {
if(H[i] + A[i] * x >= L)
ans += H[i] + A[i] * x;
}
if(ans >= S) return true;
return false;
}
signed main() {
scanf("%llu%llu%llu", &n, &S, &L);
for(int i = 1; i <= n; i++)
scanf("%llu", &H[i]);
for(int i = 1; i <= n; i++)
scanf("%llu", &A[i]);
int L = 0, R = 1e18;
while(L + 1 < R) {
int M = (L + R) / 2;
if(check(M)) R = M;
else L = M;
}
printf("%llu\n", R);
return 0;
}