# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
628867 | kkkkkkkk | 송신탑 (IOI22_towers) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<int> height;
int N,k=0;
void init(int n,vector<int> H)
{
N=n;
height=H;
}
int max_towers(int l,int r,int d)
{
int res=1;
vector<int> dp(n,1);
for (int i=l;i<=r;i++)
{
int tower=height[i-1];
for (int j=i-2;j>=l;j--)
{
if (tower-d>=height[j]&&tower-d>=height[i])
dp[i]=max(dp[i],dp[j]+1);
tower=max(tower,height[j]);
}
res=max(dp[i],res);
}
return res;
}