Submission #607425

# Submission time Handle Problem Language Result Execution time Memory
607425 2022-07-26T17:08:47 Z CoolRabbitXT Dancing Elephants (IOI11_elephants) C++14
0 / 100
1 ms 340 KB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;


int n;
int l;
vector <int> x;
vector <int> sorted;
int current_first;
int camera_count = 1;
void init(int N, int L, int X[])
{
  n = N;
  l = L;
  x.resize(n);
  for(int i = 0; i < n; i++){
    x[i] = X[i];
  }
}

int update(int i, int y)
{
  x[i] = y;
  for(int i = 0; i<n; i++){
    sorted[i] = x[i];
  }
  sort(sorted.begin(), sorted.end());
  current_first = sorted[0];
  for(int i = 1; i<n; i++){
    if(x[i] - current_first > l){
      camera_count ++;
      current_first = sorted[i];
    }
  }
  return camera_count;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -