Submission #29126

# Submission time Handle Problem Language Result Execution time Memory
29126 2017-07-18T10:47:14 Z dereotu Dancing Elephants (IOI11_elephants) C++14
10 / 100
9000 ms 18424 KB
#include "elephants.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define forr(i,A,B) for(int i=A;i<B;++i)
#define space ' '
#define endl '\n'
#define LL long long
using namespace std;
int n,l;

pair<int,int> a[100005];

void init(int N, int L, int X[]){
	l=L;
	n = N;
	forr(i,0,N){
		a[i].st=X[i];
		a[i].nd=i;
	}
	
}

int update(int i, int y){
	int ans=1;
	a[a[i].nd].st=y;
	sort(a,a+n);
	int lp=0,rp=0;
	while(rp<n){
		if(a[rp].st-a[lp].st<=l){
			rp++;
		}
		else{
			ans++;
			lp=rp;
			++rp;
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 18424 KB Output is correct
2 Correct 0 ms 18424 KB Output is correct
3 Correct 0 ms 18424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 18424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9000 ms 18424 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 18424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 18424 KB Output isn't correct
2 Halted 0 ms 0 KB -