Submission #500323

#TimeUsernameProblemLanguageResultExecution timeMemory
500323aryan12Dancing Elephants (IOI11_elephants)C++17
10 / 100
1 ms332 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; int n, len; set<int> pos; int cur_pos[MAXN]; void init(int N, int L, int X[]) { n = N; len = L; for(int i = 0; i < N; i++) { pos.insert(X[i]); cur_pos[i] = X[i]; } } int update(int i, int y) { pos.erase(cur_pos[i]); cur_pos[i] = y; pos.insert(cur_pos[i]); int ans = 0, x = *(pos.begin()); while(true) { ans++; if(pos.lower_bound(x + len + 1) == pos.end()) { break; } x = *(pos.lower_bound(x + len)); } return ans; }
#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...