Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int convexity_n4(vector<point> a) {
- sort(all(a)); //sort by increasing of x, if equal: by y
- int ans = 0;
- forn(i, a.size()) {
- vector<point> b(a.begin() + i + 1, a.end());
- sort(all(b), cmp(a[i])); //sort by relative angle to a[i]
- b.insert(b.begin(), a[i]);
- if ((int)b.size() <= ans)
- continue;
- memset(z, 0, sizeof(z));
- for (int j = 1; j < (int)b.size(); j++) {
- z[0][j] = 2;
- forn(t, j)
- if (z[t][j]) {
- ans = max(ans, z[t][j]);
- for (int k = j + 1; k < (int)b.size(); k++)
- if (vec(b[t], b[j], b[k]) > 0)
- z[j][k] = max(z[j][k], z[t][j] + 1);
- }
- }
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement