# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789718 | IBory | 역사적 조사 (JOI14_historical) | C++17 | 4078 ms | 14024 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>
#define pii pair<ll, ll>
typedef long long ll;
using namespace std;
const int MAX = 123456, SQ = 8;
ll X[MAX], ans[MAX], cnt[MAX], S[MAX];
multiset<ll> cand[MAX >> SQ];
struct Query {
int s, e, id;
Query(int a = 0, int b = 0, int c = 0) {
s = a, e = b, id = c;
}
const bool operator<(Query& a) {
if ((s >> SQ) != (a.s >> SQ)) return (s >> SQ) < (a.s >> SQ);
return e > a.e;
}
} QS[MAX];
void Add(int idx) {
int n = S[idx];
if (cnt[n]) cand[n >> SQ].erase(cand[n >> SQ].find(X[n] * cnt[n]));
cand[n >> SQ].insert(X[n] * (++cnt[n]));
}
void Sub(int idx) {
int n = S[idx];
cand[n >> SQ].erase(cand[n >> SQ].find(X[n] * cnt[n]));
if (--cnt[n]) cand[n >> SQ].insert(X[n] * cnt[n]);
# | 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... |