제출 #1334973

#제출 시각아이디문제언어결과실행 시간메모리
1334973BlockOG코끼리 (Dancing Elephants) (IOI11_elephants)C++20
26 / 100
9086 ms1604 KiB
#include <bits/stdc++.h>

// meeeooowwwww mrrowwww :3
// go play vivid/stasis!! now!!!! https://vividstasis.gay

#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
using namespace std;

int ____init = []{
    ios::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    return 0;
}();

int l;
vector<int> elephants;
multiset<int> positions;

void init(int n, int _l, int x[]) {
    l = _l;
    fo(i, 0, n) elephants.pb(x[i]), positions.insert(x[i]);
}

int update(int i, int v) {
    positions.erase(positions.lb(elephants[i]));
    positions.insert(elephants[i] = v);
    
    int res = 0;
    for (auto it = positions.begin(); it != positions.end(); it = positions.ub(*it + l)) res++;

    return res;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...