#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll>v[200001];
int main()
{
ll r , c , n , x , y , a, b, t;
cin >> r>> c >> n ;
//cout << r << " " << c << " " << n << "\n";
map<ll,ll>mp;
//cout << "haha\n";
ll cnt=1;
for(int i = 0 ; i < n ; i++)
{
cin >> x>> y ;
if(!mp[x])mp[x]=cnt++;
v[mp[x]].push_back(y);
}
for(int i =1 ;i < cnt ; i++)
{
sort(v[i].begin() , v[i].end());
}
cin >> t;
while(t--)
{
cin>> x >> y >> a >> b ;
if(x==a)
{
if(y<=b)
{
cout << "Yes\n";
}
else cout << "No\n";
continue;
}
int j=y;
int impos=1;
for(int i = x ; i<a ; i++)
{
if(mp[i]==0)
{
impos=1;
break;
}
vector<ll>::iterator it = lower_bound(v[mp[i]].begin() , v[mp[i]].end() , j);
if(it==v[mp[i]].end())
{
j=c+1;
}
else j=*it;
//cout << j << "\n";
if(j>b)
{
impos=1;
break;
}
if(i==a-1)
{
impos=0;
}
}
if(impos)
{
cout << "No\n";
}
else cout << "Yes\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
5116 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
10 ms |
5228 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
9 ms |
5100 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
200 ms |
8064 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
200 ms |
8320 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
418 ms |
7660 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
622 ms |
8192 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1010 ms |
8088 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
1010 ms |
7704 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
1018 ms |
8044 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
1096 ms |
8556 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
1092 ms |
8684 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
1327 ms |
13364 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
5248 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
37 ms |
5100 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
32 ms |
5612 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
28 ms |
5356 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
510 ms |
5740 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
29 ms |
5356 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2079 ms |
13440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |