Submission #269140

# Submission time Handle Problem Language Result Execution time Memory
269140 2020-08-17T05:23:38 Z Plurm Dancing Elephants (IOI11_elephants) C++11
50 / 100
9000 ms 3576 KB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;

int n, l;
int arr[150005];
int pos[150005];
void init(int N, int L, int X[])
{
	n = N;
	l = L;
	for(int i = 0; i < N; i++){
		arr[i] = X[i];
		pos[i] = X[i];
	}
}

int update(int i, int y)
{
	int idx = lower_bound(arr, arr+n, pos[i]) - arr;
	for(int j = idx; j < n; j++) arr[j] = arr[j+1];
	pos[i] = y;
	idx = lower_bound(arr, arr+n-1, pos[i]) - arr;
	for(int j = n-1; j > idx; j--) arr[j] = arr[j-1];
	arr[idx] = pos[i];
	int last = -1;
	int c = 0;
	for(int j = 0; j < n; j++){
		if(last < arr[j]){
			last = arr[j]+l;
			c++;
		}
	}
	return c;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2254 ms 1132 KB Output is correct
8 Correct 3338 ms 1188 KB Output is correct
9 Correct 3823 ms 1528 KB Output is correct
10 Correct 3479 ms 1656 KB Output is correct
11 Correct 3699 ms 1576 KB Output is correct
12 Correct 8130 ms 1576 KB Output is correct
13 Correct 4081 ms 2708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2254 ms 1132 KB Output is correct
8 Correct 3338 ms 1188 KB Output is correct
9 Correct 3823 ms 1528 KB Output is correct
10 Correct 3479 ms 1656 KB Output is correct
11 Correct 3699 ms 1576 KB Output is correct
12 Correct 8130 ms 1576 KB Output is correct
13 Correct 4081 ms 2708 KB Output is correct
14 Correct 2210 ms 2944 KB Output is correct
15 Correct 6355 ms 2908 KB Output is correct
16 Execution timed out 9102 ms 3576 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2254 ms 1132 KB Output is correct
8 Correct 3338 ms 1188 KB Output is correct
9 Correct 3823 ms 1528 KB Output is correct
10 Correct 3479 ms 1656 KB Output is correct
11 Correct 3699 ms 1576 KB Output is correct
12 Correct 8130 ms 1576 KB Output is correct
13 Correct 4081 ms 2708 KB Output is correct
14 Correct 2210 ms 2944 KB Output is correct
15 Correct 6355 ms 2908 KB Output is correct
16 Execution timed out 9102 ms 3576 KB Time limit exceeded
17 Halted 0 ms 0 KB -