#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
#include <unordered_map>
#define endl '\n'
#define mid ((l+r)/2)
#define F first
#define S second
#define pb push_back
#define yes void (cout<<"YES"<<endl)
#define no void (cout<<"NO"<<endl)
#define ump unordered_map <ll,ll>
#define sp " "
#define vll vector<ll>
#define vint vector<int>
#define pll pair<ll,ll>
typedef long long ll;
using namespace std;
const ll inf=1e18+9;
const int N=2e5+9;
const ll M=1e9+7;
ll n,q;
int main(){
cin>>n>>q;
map<ll,pll> mp;
for(ll i=0 ;i<n ; i++){
ll x,y;
cin>>x>>y;
mp[i]={x,y};
}
while(q--){
ll x,y;
cin>>x>>y;
x--; y--;
if(mp[x].S>=mp[y].F&&mp[x].S<mp[y].S){
cout<<1<<endl;
}
else{
cout<<"impossible"<<endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
244 ms |
7644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |