제출 #609439

#제출 시각아이디문제언어결과실행 시간메모리
609439CoolRabbitXT코끼리 (Dancing Elephants) (IOI11_elephants)C++14
0 / 100
0 ms212 KiB
#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+1);
  for(int i = 0; i < n; i++){
    x[i] = X[i];
  }
  sorted.resize(n);
}



int update(int i, int y)
{
  camera_count = 1;
  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 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...