Submission #896471

# Submission time Handle Problem Language Result Execution time Memory
896471 2024-01-01T14:02:57 Z anton Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 12892 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){
    if(*it > cur_max){
      res++;
      cur_max = (*it) + l;
    }
  }
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 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 6488 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 6584 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 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 6584 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 4392 ms 10340 KB Output is correct
8 Correct 6552 ms 10700 KB Output is correct
9 Execution timed out 9054 ms 12892 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 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 6584 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 4392 ms 10340 KB Output is correct
8 Correct 6552 ms 10700 KB Output is correct
9 Execution timed out 9054 ms 12892 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 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 6584 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 4392 ms 10340 KB Output is correct
8 Correct 6552 ms 10700 KB Output is correct
9 Execution timed out 9054 ms 12892 KB Time limit exceeded
10 Halted 0 ms 0 KB -