Submission #1130243

#TimeUsernameProblemLanguageResultExecution timeMemory
1130243sohamsen15Dancing Elephants (IOI11_elephants)C++20
26 / 100
9092 ms1384 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 999999; vector<int> a; int n, l; void init(int N, int L, int X[]) { n = N; l = L; for (int i = 0; i < n; i++) a.push_back(X[i]); } int update(int idx, int y) { a[idx] = y; vector<int> b; for (auto &x: a) b.push_back(x); sort(b.begin(), b.end()); int ans = 0; for (int i = 0; i < n;) { ans++; bool done = false; for (int j = i + 1; j < n; j++) { if (b[j] - b[i] > l) { done = true; i = j; break; } else if (j == n - 1) { i = n; done = true; } } if (!done) i++; } 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...