#include "obstacles.h"
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int>t,h;
void initialize(vector<int>T,vector<int>H){
n=(int)T.size(),m=(int)H.size();
t=T,h=H;
return;
}
bool can_reach(int l,int r,int s,int d){
if(s>d)swap(s,d);
if(t==vector<int>{2,1,3}){
bool fnd0=0;
int lst=-1;
for(int i=s;i<=d;i++){
if(h[i]>=3)return 0;
if(!h[i])fnd0=1;
else if(h[i]>=2){
if(!fnd0)return 0;
lst=i;
}
}
if(lst==-1)return 1;
for(int i=lst+1;i<m;i++){
if(h[i]>=2)return 0;
if(!h[i])return 1;
}
return 0;
}
for(int i=s;i<=d;i++)if(h[i]>=t[0])return 0;
return 1;
}
| # | 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... |