Submission #628867

#TimeUsernameProblemLanguageResultExecution timeMemory
628867kkkkkkkkRadio Towers (IOI22_towers)C++17
Compilation error
0 ms0 KiB
#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; }

Compilation message (stderr)

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:17:20: error: 'n' was not declared in this scope
   17 |     vector<int> dp(n,1);
      |                    ^