#include <bits/stdc++.h>
using namespace std;
map<int, vector<int>> mp;
int xf, yf;
int yyy;
bool wae(int x, int y)
{
if(xf<x || yf<y)
{
cout<<"1\n";
return 0;
}
else if(xf==x) return 1;
else
{
yyy=lower_bound(mp[x].begin(), mp[x].end(), y)-mp[x].begin();
//cout<<x<<' '<<yyy<<' '<<mp[x][yyy]<<'\n';
if(yyy==mp[x].size())
{
//cout<<"2\n";
return false;
}
else return wae(x+1, mp[x][yyy]);
}
}
int main()
{
int r, c, n ,t;
cin>>r>>c>>n;
for(int i=0; i<n; i++)
{
int x, y;
cin>>x>>y;
mp[x].push_back(y);
}
for(auto i : mp)
{
sort(i.second.begin(), i.second.end());
}
cin>>t;
while(t--)
{
int xs, ys;
cin>>xs>>ys>>xf>>yf;
if(xf-xs>n) cout<<"No\n";
else if(wae(xs, ys)) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}
Compilation message
trampoline.cpp: In function 'bool wae(int, int)':
trampoline.cpp:21:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | if(yyy==mp[x].size())
| ~~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
YES or NO expected, but 1 found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
129 ms |
1896 KB |
YES or NO expected, but 1 found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
716 ms |
2632 KB |
YES or NO expected, but 1 found [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
348 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1239 ms |
9780 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |