Submission #896472

# Submission time Handle Problem Language Result Execution time Memory
896472 2024-01-01T14:05:14 Z anton Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 9308 KB
#include "elephants.h"
#include<bits/stdc++.h>

using namespace std;
int n;
int l;

set<int> s;
vector<int> pos;

void init(int N, int L, int X[])
{
  l =L;
  n = N;
  pos.resize(n);
  for(int i= 0; i<n; i++){
    s.insert(X[i]);
    pos[i] = X[i];
  }
}

int update(int i, int y)
{
  s.erase(pos[i]);
  pos[i] = y;
  s.insert(pos[i]);
  
  int res= 0;
  int cur_max = -1;
  for(auto it = s.begin(); it!=s.end(); it = s.upper_bound(cur_max)){
    res++;
    cur_max = (*it) + l;

  }
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9059 ms 9308 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9059 ms 9308 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Execution timed out 9059 ms 9308 KB Time limit exceeded
8 Halted 0 ms 0 KB -