#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
int n,q;
cin>>n>>q;
vector<array<int,3>> events(n);
for(int i=0;i<n;i++)
{
int e,s;
cin>>e>>s;
events[i]={e,s,i};
}
while(q--)
{
int a,b;
cin>>a>>b;
a--;
b--;
if(a==b)
cout<<"0"<<endl;
else if(events[b][1]>=events[a][1]&&events[b][1]<=events[a][0])
cout<<"1"<<endl;
else
cout<<"impossible"<<endl;
}
return 0;
}
# | 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... |