제출 #1345825

#제출 시각아이디문제언어결과실행 시간메모리
1345825SabaKharebavaDancing Elephants (IOI11_elephants)C++20
26 / 100
9089 ms1556 KiB
#include<bits/stdc++.h>

using namespace std;

int n, l, x[150001];
set<int> st;

void init(int N, int L, int X[]) {
    n = N;
    l = L;
    for (int i = 0; i < n; i++) {
        st.insert(X[i]);
        x[i] = X[i];
    }
}

int update(int i, int y) {
    st.erase(x[i]);
    x[i] = y;
    st.insert(y);

    auto it = st.begin();
    int cnt = 0;
    while (true) {
        cnt++;
        auto next = upper_bound(it, st.end(), (int)(*it) + l);
        if (next == st.end())
            break;
        it = next;
    }

    return cnt;
}
#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...