Submission #1154958

#TimeUsernameProblemLanguageResultExecution timeMemory
1154958hiderrDancing Elephants (IOI11_elephants)C++20
26 / 100
9093 ms1348 KiB
#include "elephants.h" #include <bits/stdc++.h> using namespace std; #define loop(i, a, b) for(int i = a; i <= b; i++) #define loop_rev(i, a, b) for(int i = a; i >= b; i--) #define all(x) x.begin(), x.end() #define sz(x) int(x.size()) #define pb push_back using ll = long long; vector<pair<int, int>> segs; vector<int> x, y; int n, d; void brute_segs() { segs.clear(); y = x; sort(all(y)); int i = 0; while(i < n) { segs.pb({ y[i], y[i] + d }); while(i < n && y[i] <= segs.back().second) { ++i; } } } void init(int N, int L, int X[]) { n = N, d = L; x.resize(n); loop(i, 0, n-1) { x[i] = X[i]; } brute_segs(); } int update(int i, int new_x) { x[i] = new_x; brute_segs(); return sz(segs); }
#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...