Submission #1253542

#TimeUsernameProblemLanguageResultExecution timeMemory
1253542nickolasarapidisObstacles for a Llama (IOI25_obstacles)C++20
Compilation error
0 ms0 KiB
#include "obstacles.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 200000;

int N, M;

vector<int> T(MAXN), H(MAXN), ST(4*MAXN);

void build(int v, int l, int r){
    if(l == r){
        ST[v] = H[l];
        return;
    }
    int m = (l + r)/2;
    build(2*v, l, m);
    build(2*v + 1, m + 1, r);
    ST[v] = max(ST[2*v], ST[2*v + 1]);
    return;
}

int query(int v, int l, int r, int a, int b){
    if(l > b or r < a) return -1;
    if(l >= a and r <= b) return ST[v];
    int m = (l + r)/2;
    return max(query(2*v, l, m, a, b), query(2*v + 1, m + 1, r, a, b));
}

bool can_reach(l, r, s, d){
    if(query(1, 0, M - 1, s, d) >= T[N - 1]) return false;
    else return true;
}

void initialize(vector<int> A, vector<int> B){
    N = A.size(); M = B.size();
    T = A; H = B;
    build(1, 0, M - 1);
}

Compilation message (stderr)

obstacles.cpp:30:16: error: 'bool can_reach' redeclared as different kind of entity
   30 | bool can_reach(l, r, s, d){
      |                ^
In file included from obstacles.cpp:1:
obstacles.h:5:6: note: previous declaration 'bool can_reach(int, int, int, int)'
    5 | bool can_reach(int L, int R, int S, int D);
      |      ^~~~~~~~~
obstacles.cpp:30:16: error: 'l' was not declared in this scope
   30 | bool can_reach(l, r, s, d){
      |                ^
obstacles.cpp:30:19: error: 'r' was not declared in this scope
   30 | bool can_reach(l, r, s, d){
      |                   ^
obstacles.cpp:30:22: error: 's' was not declared in this scope
   30 | bool can_reach(l, r, s, d){
      |                      ^
obstacles.cpp:30:25: error: 'd' was not declared in this scope
   30 | bool can_reach(l, r, s, d){
      |                         ^