#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vei;
typedef vector<vei> vevei;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) a.size()
#define con cout << "NO\n"
#define coe cout << "YES\n";
#define str string
#define pb push_back
#define ff first
#define sc second
#define ss second
#define pii pair<int, int>
#define mxe max_element
#define mne min_element
#define stf shrink_to_fit
#define f(i, l, r) for (int i = (l); i < (r); i++)
#define double ld
#define int ll
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll n, m; cin >> n >> m;
vector<int> a(n), b(n);
f(i, 0, n) { ll x; cin >> x; a[i] = (int)x; }
f(i, 0, n) { ll x; cin >> x; b[i] = (int)x; }
int L = -1, R = 1000000000000000001;
while (R - L > 1) {
int M = (L + R) / 2;
int need = 0;
f(i, 0, n) {
if (b[i] > a[i]) {
need += (M + b[i] - 1) / b[i];
}
else {
if ((M + a[i] - 1) / a[i] <= m) {
need += (M + a[i] - 1) / a[i];
}
else {
need += m + (M - a[i] * (int)m + b[i] - 1) / b[i];
}
}
}
if (need > (int)m * (int)n) R = M;
else L = M;
}
cout << (ll)L << '\n';
return 0;
}
Compilation message
Main.cpp:37:2: error: extended character is not valid in an identifier
37 | int L = -1, R = 1000000000000000001;
| ^
Main.cpp:37:5: error: extended character is not valid in an identifier
37 | int L = -1, R = 1000000000000000001;
| ^
Main.cpp: In function 'int main()':
Main.cpp:37:2: error: '\U000000a0' was not declared in this scope
37 | int L = -1, R = 1000000000000000001;
| ^
Main.cpp:38:12: error: 'R' was not declared in this scope
38 | while (R - L > 1) {
| ^
Main.cpp:38:16: error: 'L' was not declared in this scope
38 | while (R - L > 1) {
| ^
Main.cpp:57:17: error: 'L' was not declared in this scope
57 | cout << (ll)L << '\n';
| ^