답안 #1076885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076885 2024-08-26T17:58:11 Z Trumling 송신탑 (IOI22_towers) C++17
컴파일 오류
0 ms 0 KB
#include "towers.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
 
#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999
ll n;
vector<ll>h;
void init(int N, vector<int> H) 
{
  n=N;
  for(int i=0;i<N;i++)
    h.pb(H[i]);
    
}
 
int max_towers(int L, int R, int D) 
{
  vector<ll>v(n);
 
    for(int i=L;i<=R;i++)
      v[i]=1;
 
    for(int i=L;i<=R;i++)
    {
      ll maxi=h[i];
      for(int j=i-1;j>=L;j--)
      {
        maxi=max(maxi,h[j]);
 
        if(maxi-D>=h[j] && maxi-D>=h[i])
          if(v[i]<v[j]+1)
            v[i]=v[j] + 1
            
        
      }
    }
 
    ll maxi=0;
    for(int i=0;i<n;i++)
    maxi=max(maxi,v[i]);
 
 
    return maxi;
 
      
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:38:26: error: expected ';' before '}' token
   38 |             v[i]=v[j] + 1
      |                          ^
      |                          ;
......
   41 |       }
      |       ~