Submission #946649

#TimeUsernameProblemLanguageResultExecution timeMemory
946649OAleksaDancing Elephants (IOI11_elephants)C++14
26 / 100
9043 ms9328 KiB
#include "elephants.h" #include <bits/stdc++.h> #define f first #define s second using namespace std; const int N = 150069; int n, a[N], d; void init(int N, int L, int X[]) { n = N; d = L; for (int i = 0;i < n;i++) a[i] = X[i]; } int update(int j, int y) { vector<int> x; a[j] = y; for (int i = 0;i < n;i++) x.push_back(a[i]); sort(x.begin(), x.end()); int ans = 0; int i = 0, lst = -1; while (i < n) { if (x[i] > lst) { ++ans; lst = x[i] + d; } else ++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...