답안 #385246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385246 2021-04-03T19:32:07 Z Ahmad_Hasan Mountains (IOI17_mountains) C++17
0 / 100
1 ms 364 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);
    }

};

int32_t 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -