# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29088 | 2017-07-18T08:25:13 Z | kavun | Dancing Elephants (IOI11_elephants) | C++14 | 9000 ms | 25700 KB |
#include "elephants.h" #include <bits/stdc++.h> using namespace std; set <pair<int,int> > st; vector <int> x; int n, l; void init(int N, int L, int X[]) { n = N; l = L; for(int i = 0; i < n; i++) { st.insert(make_pair(X[i],i)); x.push_back(X[i]); } } int update(int i, int y) { int res = 1; set<pair<int,int> >::iterator it = st.find(make_pair(x[i],i)); x[i] = y; st.erase(it); st.insert(make_pair(y,i)); set<pair<int,int> >::iterator leftmost = st.begin(); while(leftmost != st.end()) { pair<int,int> pr = *leftmost; int pos = pr.first; int id = pr.second; leftmost = st.upper_bound(make_pair(pr.first + l,1e9)); if(leftmost != st.end()) res++; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17648 KB | Output is correct |
2 | Correct | 0 ms | 17648 KB | Output is correct |
3 | Correct | 0 ms | 17648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 17648 KB | Output is correct |
2 | Correct | 0 ms | 17648 KB | Output is correct |
3 | Correct | 0 ms | 17648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 9000 ms | 18336 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 9000 ms | 18600 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 9000 ms | 25700 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |