Submission #1035140

# Submission time Handle Problem Language Result Execution time Memory
1035140 2024-07-26T05:14:12 Z NeroZein Radio Towers (IOI22_towers) C++17
Compilation error
0 ms 0 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std; 

const int LOG = 18; 

int n;
int k;
vector<int> h;
vector<int> pref;

void init(int N_, vector<int> H_) {
  n = N_, h = H_;
  for (int i = 1; i < n; ++i) {
    if (h[i] > h[i - 1] && h[i] > h[i + 1]) {
      k = i;
      break;
    }
  }
}

int max_towers(int l, int r, int d) {
  if (l >= k || r <= k) {
    return 1; 
  }
  return max(a[l], a[r]) + d <= a[k];
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:26:14: error: 'a' was not declared in this scope
   26 |   return max(a[l], a[r]) + d <= a[k];
      |              ^