Submission #799912

# Submission time Handle Problem Language Result Execution time Memory
799912 2023-08-01T08:17:26 Z Sohsoh84 Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 2516 KB
// pragmas

#include "elephants.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 50000 + 10;

int X[MAXN], n, L;
set<int> st; // TODO: multiset

void init(int N, int L_, int X_[]) {
	L = L_;
	for (int i = 0; i < N; i++) {
		X[i] = X_[i];	
		st.insert(X[i]);
	}

	n = N;
}

int update(int i, int y) {
	st.erase(X[i]);
	X[i] = y;
	st.insert(X[i]);

	int ans = 0;
	int v = *st.begin();

	while (true) {
		ans++;
		auto it = st.lower_bound(v + L + 1);
		if (it == st.end()) break;
		v = *it;
	}
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9003 ms 2516 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9003 ms 2516 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Execution timed out 9003 ms 2516 KB Time limit exceeded
8 Halted 0 ms 0 KB -