Submission #385245

# Submission time Handle Problem Language Result Execution time Memory
385245 2021-04-03T19:31:03 Z Ahmad_Hasan Mountains (IOI17_mountains) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "mountains.h"
#define int long long

using namespace std;


struct angle{
    int y,x;

    angle(int y,int x):y(y),x(x){}


    bool operator< (const angle &a)const{
        if(a.x<0&&x>=0)
            return true;
        if(x<0&&a.x>=0)
            return false;



        return abs(y)*abs(a.x)<=abs(a.y)*abs(x);
    }

};

int maximum_deevs(vector<int32_t>v){
    int n=v.size();

    int dp[n];
    dp[n-1]=1;
    for(int i=n-2;i>=0;i--){
        dp[i]=0;
        angle mx(1,1);

        for(int j=i+1;j<n;j++){

            angle ang(j-i,v[i]-v[j]);
            if(j==i+1)mx=ang;

            if(ang<mx){
                dp[i]=max(dp[i],dp[j]+1);
            }else
                mx=(ang);
            ///cout<<i<<' '<<j<<' '<<mx.y<<' '<<mx.x<<' '<<ang.y<<' '<<ang.x<<' '<<(ang<mx)<<'\n';
        }

    }

    int ans=-1;
    for(int i=0;i<n;i++)
        ans=max(ans,dp[i]);


    return ans;
}

Compilation message

mountains.cpp:27:5: error: ambiguating new declaration of 'long long int maximum_deevs(std::vector<int>)'
   27 | int maximum_deevs(vector<int32_t>v){
      |     ^~~~~~~~~~~~~
In file included from mountains.cpp:2:
mountains.h:3:5: note: old declaration 'int maximum_deevs(std::vector<int>)'
    3 | int maximum_deevs(std::vector<int> y);
      |     ^~~~~~~~~~~~~