답안 #446755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446755 2021-07-23T08:06:24 Z zxcvbnm Mountains (IOI17_mountains) C++14
0 / 100
0 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.0 : ((double) i-j) / ((double) 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() {
//
//}
# 결과 실행 시간 메모리 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 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -