# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1130268 | Math4Life2020 | Two Currencies (JOI23_currencies) | C++20 | 5118 ms | 675568 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<ll,ll>;
const ll Nm = 262144; const ll E = 18; const ll INF = 2e18;
struct Node {
map<ll,ll> m0; //{cost -> #}
map<ll,pii> mps; //{aggregate cost, aggregate # at val}
ll cptot = 0;
void prc() {
mps[-INF]={0,0};
ll nc = 0; ll vc = 0;
for (pii p0: m0) {
ll n1 = p0.second; ll c1 = p0.first;
nc += n1; vc += n1*c1;
mps[c1]={vc,nc};
}
}
Node(){}
Node(vector<ll> v1) {
for (ll x: v1) {
if (x>0) {
m0[x]++;
cptot++;
} else {
m0[-x]--;
cptot--;
}
}
prc();
# | 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... |