Submission #1299272

#TimeUsernameProblemLanguageResultExecution timeMemory
1299272alexrana2626Obstacles for a Llama (IOI25_obstacles)C++20
Compilation error
0 ms0 KiB
#include "obstacles.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v, v1;

void initialize(vector<int> T, vector<int> H) 
{
    for (int i = 0; i < H.size(); i++)
    {
    	if (T[0] <= H[i]) v.push_back(i);
	}
	for (int i = 0; i < H.size(); i++)
	{
		if (T[T.size() - 1] <= H[i]) v1.push_back(i);
	}
	return;
}

bool can_reach(int L, int R, int S, int D) 
{
	if (T.size() == 1)
	{
		auto it = lower_bound(v.begin(), v.end(), min(S, D));
	    if (it != v.end() && *it < max(S, D))
	    {
		    return false;
	    }
	    return true;
	}
	else 
	{
		auto it = lower_bound(v1.begin(), v1.end(), min(S, D));
	    if (it != v1.end() && *it < max(S, D))
	    {
		    return false;
	    }
	    return true;
	}
}

Compilation message (stderr)

obstacles.cpp: In function 'bool can_reach(int, int, int, int)':
obstacles.cpp:21:13: error: 'T' was not declared in this scope
   21 |         if (T.size() == 1)
      |             ^
obstacles.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^