# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718021 | hariaakas646 | Self Study (JOI22_ho_t2) | C++14 | 219 ms | 8552 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define scd(t) scanf("%d", &t)
#define scld(t) scanf("%ld", &t)
#define sclld(t) scanf("%lld", &t)
#define scc(t) scanf("%c", &t)
#define scs(t) scanf("%s", t)
#define scf(t) scanf("%f", &t)
#define sclf(t) scanf("%lf", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long int li;
typedef unsigned long int uli;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;
lli n, m;
bool check(lli x, vll &vec)
{
lli tot = 0;
for (auto e : vec)
{
tot += (x + e - 1) / e;
}
return tot <= n * m;
}
int main()
{
sclld(n);
sclld(m);
lli mi = 1e15;
vll vec(n);
frange(i, n)
{
sclld(vec[i]);
}
frange(i, n)
{
lli a;
sclld(a);
vec[i] = max(vec[i], a);
}
mi = *min_element(all(vec));
lli hi = (mi * m) * n;
lli lo = 0;
while (hi != lo)
{
lli mid = (hi + lo + 1) / 2;
if (check(mid, vec))
{
lo = mid;
}
else
{
hi = mid - 1;
}
}
printf("%lld", lo);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |