#include <bits/stdc++.h>
#define ll long long
#define sz size()
#define pb push_back
#define all(x) x.begin() , x.end()
using namespace std;
int main()
{
int r , c , n ; cin >> r >>c >> n ;
map<int,vector<int> >mp;
vector<pair<int,int>> temp ;
for (int i = 0; i < n; i++)
{
int a, b ; cin >> a >> b;
temp.pb({a , b}) ;
}
sort(all(temp)) ;
for (int i = 0; i < n; i++)
{
mp[temp[i].first].pb(temp[i].second);
}
int t ; cin >> t;
for (int i = 0; i < t; i++)
{
vector<int> v ; bool ok= 0 ;
int sx , sy , ex , ey ; cin >> sx >> sy >> ex >> ey;
if(ex < sx || ey < sy || !mp.count(sx)) { cout<<"No\n"; continue; }
v.pb(sy);
for(int j = sx ; j < ex ; j ++ ){
if(mp.count(j) == 0) { ok = 1;break; }
auto itt = lower_bound(all(mp[j]) , sy) ;
if(itt==mp[j].end()) { v.pb(-1);ok=1; break ; }
v.pb(*itt) ;
sy = *itt ;
//cout<<sy<<" " ;
}
if(ey >= sy && ok == 0 )cout<<"Yes\n"; else cout<<"No\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
600 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
4 ms |
604 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
3 ms |
604 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
124 ms |
5316 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
126 ms |
5100 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
250 ms |
4544 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
548 ms |
5112 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
576 ms |
15596 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
564 ms |
15416 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
570 ms |
15300 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
618 ms |
15592 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
616 ms |
15548 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
688 ms |
21664 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
604 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
21 ms |
852 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
16 ms |
1336 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
14 ms |
600 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
359 ms |
956 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
14 ms |
856 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2049 ms |
15552 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |