# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472011 | prvocislo | Cake 3 (JOI19_cake3) | C++17 | 1 ms | 332 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 <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
typedef long long ll;
using namespace std;
const int maxn = 1 << 18;
const ll inf = 1e18;
int cnt[maxn * 2];
ll sum[maxn * 2];
void update(int val, int vr)
{
vr += maxn, cnt[vr] = (val ? 1 : 0), sum[vr] = val;
for (vr = vr >> 1; vr > 0; vr >>= 1) cnt[vr] = cnt[vr << 1] + cnt[vr << 1 | 1], sum[vr] = sum[vr << 1] + sum[vr << 1 | 1];
}
int n, m, L = 0, R = -1;
struct cake { ll v, c; } c[maxn];
bool cmp(const cake& a, const cake& b) { return a.c < b.c; }
pair<ll, int> v2[maxn];
int ord[maxn];
ll mbest()
{
ll val = 0; int left = m;
for (int vr = 1; vr < maxn;)
if (cnt[vr << 1] <= left)
{
left -= cnt[vr << 1];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |