# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
545548 | LucaDantas | Cake 3 (JOI19_cake3) | C++17 | 4038 ms | 12720 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>
using namespace std;
#define int long long
constexpr int maxn = 2e5+10;
long long ans = -0x3f3f3f3f3f, val[maxn], c[maxn];
struct Set {
int sz;
long long sum = 0;
multiset<int> st;
Set(int _sz) : sz(_sz) {}
void add(int x) {
sum += x;
st.insert(x);
if(st.size() > sz)
sum -= *st.begin(), st.erase(st.begin());
}
long long get() {
if(st.size() < sz) return -0x3f3f3f3f3f;
return sum;
}
};
int32_t main() {
int n, m; scanf("%lld %lld", &n, &m);
vector<pair<int,int>> cakes(n);
for(pair<int,int>& p : cakes)
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... |