# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168954 | MateiKing80 | Distributing Candies (IOI21_candies) | C++20 | 659 ms | 25616 KiB |
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
struct Buckets
{
int n;
int bucket_size, bucket_cnt;
vector<int> vals;
vector<long long> mini, maxi, sums;
Buckets(int _n): n(_n)
{
bucket_size = sqrt(n);
bucket_cnt = (n + bucket_size - 1) / bucket_size;
vals.assign(n, 0);
mini.assign(bucket_cnt, 0);
maxi.assign(bucket_cnt, 0);
sums.assign(bucket_cnt, 0);
}
void update(int x, int val)
{
vals[x] = val;
int bucket = x / bucket_size;
mini[bucket] = maxi[bucket] = sums[bucket] = 0;
for (int i = min(n, (bucket + 1) * bucket_size) - 1; i >= bucket * bucket_size; i --)
{
sums[bucket] += vals[i];
# | 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... |