Submission #347008

# Submission time Handle Problem Language Result Execution time Memory
347008 2021-01-11T13:56:28 Z mohamedsobhi777 Mountains (IOI17_mountains) C++14
Compilation error
0 ms 0 KB
#include "mountains.h"
#include <bits/stdc++.h>
#include <vector>
#include "grader.cpp"

using namespace std;

const int N = 2000 + 2;

int dp[N][N];
vector<int> a;

#define pnt complex<long long>

long long cross(pnt x, pnt y)
{
       return imag(conj(x) * y);
}

long long cross(pnt x, pnt y, pnt z)
{
       return cross(y - x, z - y);
}

long long ccw(pnt a, pnt b, pnt c)
{
       return (real(b) - real(a)) * (imag(c) - imag(a)) - (imag(b) - imag(a)) * (real(c) - real(a));
}

bool isR(pnt x, pnt y, pnt z)
{
       return cross(y - x, z - y) >= 0;
}

int maximum_deevs(std::vector<int> y)
{
       a = y;
       int n = (int)y.size();
       for (int i = 0; i < n; ++i)
       {
              dp[i][i] = 1;
              int kah = i;
              int sum = 0;
              for (int j = i - 1; j >= 0; --j)
              {
                     dp[j][i] = dp[j][i - 1];
                     if (cross(pnt(j, a[j]), pnt(kah, a[kah]), pnt(i, a[i])) >= 0 )
                     {
                            sum += dp[j + 1][kah - 1];
                            kah = j;
                     }
                     dp[j][i] = max(dp[j][i], sum + 1 + dp[j][kah - 1]);
              }
       }
       return dp[0][n - 1];
}

Compilation message

/tmp/ccuwvMam.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccIpoF8c.o:mountains.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status