#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int n,m,k,q;
pair<int,int>tr[200010];
int xb,yb,xe,ye;
int cb(int b,int e)
{
if(b>e)
return b;
int m=(b+e)/2;
if(tr[m].first<xb||tr[m].first==xb&&tr[m].second<yb)
return cb(m+1,e);
return cb(b,m-1);
}
ifstream in("test.in");
ofstream out("test.out");
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>k;
for(int i=1;i<=k;++i)
cin>>tr[i].first>>tr[i].second;
sort(tr+1,tr+k+1);
tr[k+1]={1111111111,1111111111};
cin>>q;
while(q--)
{
cin>>xb>>yb>>xe>>ye;
int poz=cb(1,k);
int l=xb,c=yb;
while(l!=xe)
{
if(tr[poz].first==l)
{
++l;
c=tr[poz].second;
}
else
{
c=1111111111;
break;
}
if(l==xe||c>ye)
break;
while(tr[poz].first<l||tr[poz].first==l&&tr[poz].second<c)
++poz;
}
if(c<=ye)
cout<<"Yes"<<'\n';
else
cout<<"No"<<'\n';
}
return 0;
}
Compilation message
trampoline.cpp: In function 'int cb(int, int)':
trampoline.cpp:13:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
13 | if(tr[m].first<xb||tr[m].first==xb&&tr[m].second<yb)
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
trampoline.cpp: In function 'int main()':
trampoline.cpp:49:52: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
49 | while(tr[poz].first<l||tr[poz].first==l&&tr[poz].second<c)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
332 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
332 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
1860 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
56 ms |
1856 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
432 ms |
1872 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
209 ms |
1880 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
157 ms |
2576 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
162 ms |
2500 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
165 ms |
2500 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
162 ms |
2500 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
162 ms |
2528 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
172 ms |
2580 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
332 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
11 ms |
368 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
4 ms |
332 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
8 ms |
372 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
21 ms |
376 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
7 ms |
332 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2094 ms |
1876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |