Submission #1240899

#TimeUsernameProblemLanguageResultExecution timeMemory
1240899chinesegenius69420코끼리 (Dancing Elephants) (IOI11_elephants)C++20
26 / 100
9043 ms1388 KiB
#include <bits/stdc++.h>
#include "elephants.h"

#define dbg(x) cerr << #x << ": " << x << '\n';

using namespace std;
vector<int> pos;
int l, n;
void init(int N, int L, int X[]){
	l = L;
	n = N;
	for(int i = 0; i < N; i++){
		pos.push_back(X[i]);
	}
}

int update(int i, int y){
	int ans = 1;
	pos[i] = y;
	vector<int> nose;
	for(const int &i : pos) nose.push_back(i);
	sort(nose.begin(), nose.end());
	int aux = l + 1;
	for(int i = 0; i < n - 1; i++){
		if(nose[i + 1] - nose[i] + 1 <= aux){
			aux -= nose[i + 1] - nose[i];
			continue;
		}
		ans++;
		aux = l + 1;
	}
	return ans;
}
#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...