# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
832094 | QwertyPi | Diversity (CEOI21_diversity) | C++14 | 0 ms | 212 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 all(x) (x).begin(), (x).end()
#define int long long
using namespace std;
const int MAXN = 3e5 + 11;
const int MAXQ = 5e4 + 11;
const int SQ = 1000;
int a[MAXN];
int ans[MAXQ];
int c[MAXN], cc[MAXN];
int s0, s1, s2;
set<int> s;
void add(int x){
s0 -= c[x] * (c[x] + 1) / 2;
s1 -= c[x];
s2 -= c[x] * c[x];
cc[c[x]]--; if(cc[c[x]] == 0) s.erase(c[x]);
c[x]++;
s0 += c[x] * (c[x] + 1) / 2;
s1 += c[x];
s2 += c[x] * c[x];
cc[c[x]]++; if(cc[c[x]] == 1) s.insert(c[x]);
}
void rem(int x){
s0 -= c[x] * (c[x] + 1) / 2;
s1 -= c[x];
s2 -= c[x] * c[x];
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |