# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
362678 | hoaphat1 | Cake 3 (JOI19_cake3) | C++17 | 1499 ms | 38500 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;
int main() {
#define qwer "test"
if (fopen(qwer".inp","r")) freopen(qwer".inp","r",stdin),freopen(qwer".out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first;
sort(a.begin(), a.end());
/*
k1 k2 ... km -> v - 2 * (c km - c k1)
i >= i-1
*/
long long ans = -1e18;
long long now = 0;
int L = 0, R = -1;
vector<int> kt(n, 0);
priority_queue<pair<int, int>, vector<pair<int,int>> , greater<pair<int, int>>> pq;
priority_queue<pair<int, int>> smaller;
int sz = 0;
auto add = [&](int id) {
int v = a[id].second;
pq.emplace(v, id);
now += v;
kt[id] = 1;
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... |