Submission #308300

# Submission time Handle Problem Language Result Execution time Memory
308300 2020-09-30T21:21:31 Z kimjg1119 Mountains (IOI17_mountains) C++17
0 / 100
1 ms 256 KB
#include "mountains.h"
#include <vector>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

struct pt {
	ll x, y;
};

int ccw(pt a, pt b, pt c) {
	ll t = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
	return t ? (t > 0 ? 1 : -1) : 0;
}

int dp[2020] = {};
int maximum_deevs(std::vector<int> y) {
	int n = y.size();
	for (int i = 0; i < n; i++) {
		dp[i] = 1;
		for (int j = 0; j < i; j++) {
			bool flag = false;
			for (int k = j + 1; k < i; k++)
				if (ccw({ j,y[j] }, { i,y[i] }, { k,y[k] }) < 0) flag = true;
			if (flag) dp[i] = max(dp[i], dp[j] + 1);
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -