inline T read(){ T sum = 0, fl = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1; for (; isdigit(ch); ch = getchar()) sum = sum * 10 + ch - '0'; return sum * fl; }
template <typename T>
inlinevoidwrite(T x){ if (x < 0) { putchar('-'), write<T>(-x); return; } static T sta[35]; int top = 0; do { sta[top++] = x % 10, x /= 10; } while (x); while (top) putchar(sta[--top] + 48); }
intmain(){ n = read<int>(); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i < n; i++) scanf("%d", &b[i]), c[i] = b[i]; // 是<哦~ sort(a + 1, a + n + 1); int l = 1, r = 1e9, ret = -1; // 要求箱子是正整数个,从 1 开始 while (l <= r) { int mid = (l + r) >> 1; if (chk(mid)) { ret = mid; r = mid - 1; } else l = mid + 1; } write<int>(ret); return0; }