Submission #575188

# Submission time Handle Problem Language Result Execution time Memory
575188 2022-06-09T20:53:06 Z d4xn Mountains (IOI17_mountains) C++17
0 / 100
0 ms 212 KB
#pragma GCC optimize ("Ofast")
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std;

#define ld long double
#define ll long long

const int N = 2002;

ll n, ans;
//ll dp[N];

int maximum_deevs(vector<int> y) {
	n = y.size();
	ans = 0;
	/*
	for (ll i = 0; i < n; i++) {
		dp[i] = 1;
		for (ll j = 0; j < i; j++) {
			for (ll k = j+1; k < i; k++) {
				ld a = i;
				ld b = j;
				ld c = k;
				ld d = y[i];
				ld e = y[j];
				ld f = y[k];

				ld p = (d-e) / (a-b);
				ld h = e + ((c-b) * p);

				if (f > h) {
					dp[i] = max(dp[i], dp[j]+1);
					break;
				}
			}
		}
		ans = max(ans, dp[i]);
	}
	*/
	if (y[0] < y[1]) ans++;
	for (ll i = 1; i < n-1; i++) {
		if (y[i] < y[i-1] && y[i] < y[i+1]) ans++;
	}
	if (y[n-1] < y[n-2]) ans++;
	return max(ans, 1ll);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -