Submission #446753

# Submission time Handle Problem Language Result Execution time Memory
446753 2021-07-23T08:05:11 Z zxcvbnm Mountains (IOI17_mountains) C++14
0 / 100
1 ms 204 KB
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> a;
bool can(int i, int j) {
	double slope = a[i] == a[j] ? 0 : (i-j) / (a[i]-a[j]);
	double curr = a[i];
	for(int k = i+1; k < j; k++) {
		curr += slope;
		if ((double) a[k] > curr) {
			return true;
		}
	}
	return false;
}
int maximum_deevs(std::vector<int> y) {
	int n = y.size();
	a = y;
	vector<int> dp(n+1, 1);
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			if (can(i, j)) {
				dp[j] = max(dp[j], dp[i]+1);
			}
		}
	}
//	for(int i : dp) {
//		cout << i << " ";
//	}
	return *max_element(dp.begin(), dp.end());
}

//int main() {
//
//}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -