제출 #106287

#제출 시각아이디문제언어결과실행 시간메모리
106287tincamatei코끼리 (Dancing Elephants) (IOI11_elephants)C++14
26 / 100
9068 ms2048 KiB
#include "elephants.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 150000;

int N, L;
int v[MAX_N];
int aux[MAX_N];

void init(int _N, int _L, int X[]) {
	N = _N;
	L = _L;

	for(int i = 0; i < N; ++i) {
		v[i] = X[i];
	}
}

int update(int x, int y) {
	int i, j;
	
	v[x] = y;
	for(i = 0; i < N; ++i)
		aux[i] = v[i];
	
	sort(aux, aux + N);

	i = 0;
	
	int rez = 0;
	while(i < N) {
		j = i;
		while(j < N && aux[i] + L >= aux[j])
			++j;

		i = j;
		rez++;
	}

	return rez;
}
#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...