#include "obstacles.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
vector<int>k;
vector<int>h;
long long n,bati;
void initialize(vector<int> T, vector<int> H) {
n=H.size();
int j=0;
bati=T.size();
for(int j=0; j<H.size(); j++){
if(T[0]<=H[j]){
//x[j]=-1;
k.push_back(j);
}
else{
//x[j]=1;
}
//cout<<x[j]<<" ";
//x[j]=a;
//j++;
}
for(int i=0; i<H.size(); i++){
if(T[bati-1]<=H[i]){
h.push_back(i);
//x[i]=-1;
}
}
return;
}
bool can_reach(int L, int R, int S, int D) {
//L--,R--,S--,D--;
if(S>D)swap(S,D);
if(bati==1){
auto it=lower_bound(k.begin(),k.end(),S);
if(it!=k.end() && *it<D){
return 0;
}
//if(lower_bound(k.begin(),k.end(),S)<D)return 0;
else return true;
}
else{
auto it=lower_bound(h.begin(),h.end(),S);
if(it!=h.end() && *it<D){
return 0;
}
//if(lower_bound(k.begin(),k.end(),S)<D)return 0;
else return true;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |