# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
233067 | oolimry | Cake 3 (JOI19_cake3) | C++14 | 3750 ms | 15468 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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#define C first
#define V second
using namespace std;
typedef pair<long long, long long> ii;
int n, m;
long long op[300005];
ii arr[200005];
struct maxM{
multiset<int> take;
multiset<int> notake;
long long total = 0;
int l = -1, r = -1;
void include(long long pos){
long long x = arr[pos].V;
if(l == -1){ ///initialise first element
l = pos; r = pos;
}
else r++; ///expand
take.insert(x); total += x;
if((int) take.size() > m){
auto it = take.begin();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |