Submission #261534

# Submission time Handle Problem Language Result Execution time Memory
261534 2020-08-11T20:33:21 Z test2 Dancing Elephants (IOI11_elephants) C++14
26 / 100
9000 ms 4048 KB
//#include "elephants.h"
#include<bits/stdc++.h>

#define I inline void 

using namespace std ; 

using ld = long double ; 
using ll = long long ; 

const int N = 1e6  + 7 , mod = 1e9 + 7 ; 

int n;
int c ; 

map<int , int > ele ; 
int pos[N]; 

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

int answer(){
	int ret = 0 ; 
	int l = -1e9 ; 
	for(auto u : ele){
		if(u.second){
			if(u.first > l + c){
				ret++ ; 
				l = u.first ; 
			}
		}
	}
	return ret ; 
}

int update(int i, int y)
{
	ele[pos[i]]--;
	pos[i]=y;
	ele[pos[i]]++;
	return answer() ;
}
# 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 388 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 388 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 388 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 Execution timed out 9053 ms 4048 KB Time limit exceeded
8 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 388 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 Execution timed out 9053 ms 4048 KB Time limit exceeded
8 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 388 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 Execution timed out 9053 ms 4048 KB Time limit exceeded
8 Halted 0 ms 0 KB -