제출 #1241033

#제출 시각아이디문제언어결과실행 시간메모리
1241033adriines06코끼리 (Dancing Elephants) (IOI11_elephants)C++20
0 / 100
0 ms320 KiB
#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
int n,l;
vector<int>v;
void init(int N, int L, int X[])
{
  n = N,l=L;
  v.resize(n);
  for(int i=0;i<n;i++){
    v[i]=X[i];
  }
}

int update(int i, int y)
{
  if(n==1) return 1;
  v[i]=y;
  sort(v.begin(),v.end());
  int xf=v[n-1],pos=v[0],cont=0;
  while(pos<=xf){
    int s=pos+l+1;
    auto it=lower_bound(v.begin(),v.end(),s);
    if(it==v.end()){
      pos=xf+1;
    }
    else{
      pos=*it;
    }
    cont++;
    //cout<<pos<<"\n";
  }
  return cont;
}
#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...