Submission #77137

# Submission time Handle Problem Language Result Execution time Memory
77137 2018-09-22T18:46:51 Z FiloSanza Mountains (IOI17_mountains) C++14
0 / 100
3 ms 528 KB
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std;


int maximum_deevs(vector<int> y) {
	int N = (int)y.size();
	vector<int> memo(N, 0);
	memo[N-1] = 1;

	int best = 0;
	int hi;
	for(int i=N-2; i>=0; i--){
		best = 0;
		hi = -1;
		for(int j=i+1; j<N; j++){
			//cout << i << " " << j << " " << hi << " " << y[i] << endl;
			if((y[j] < hi && abs(hi-y[i]) > abs(y[j]-hi)) || (hi > y[i] && y[j] <= hi))					//non lo vede
				best = max(best, memo[j]);
			hi = max(hi, y[j]);
		}
		memo[i] = best+1;
	}

	return *max_element(memo.begin(), memo.end());
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 500 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Incorrect 2 ms 528 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 500 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Incorrect 2 ms 528 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 500 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Incorrect 2 ms 528 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 500 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Incorrect 2 ms 528 KB Output isn't correct
7 Halted 0 ms 0 KB -