Submission #966289

# Submission time Handle Problem Language Result Execution time Memory
966289 2024-04-19T16:21:30 Z 42kangaroo Radio Towers (IOI22_towers) C++17
Compilation error
0 ms 0 KB
#include "towers.h"

#include <vector>

std::vector<int> act;

int maxI = 0;

void init(int N, std::vector<int> H) {
	using namespace std;
	act = H;
	maxI = max_element(act.begin(), act.end()) - act.begin();
}

int max_towers(int L, int R, int D) {
    if (maxI < L || maxI > R) return 1;
	if (act[maxI] - act[L] >= D && act[maxI] - act[R] >= D )return 2;
	return 1;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:12:9: error: 'max_element' was not declared in this scope
   12 |  maxI = max_element(act.begin(), act.end()) - act.begin();
      |         ^~~~~~~~~~~