제출 #896471

#제출 시각아이디문제언어결과실행 시간메모리
896471anton코끼리 (Dancing Elephants) (IOI11_elephants)C++17
26 / 100
9054 ms12892 KiB
#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 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...