#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, green;
cin >> n >> m >> green;
vector <vector <int>> a(n + 1, vector <int> (m + 1, 1));
for(int i = 0; i < green; i ++) {
int x, y;
cin >> x >> y;
a[x - 1][y - 1] = 2;
}
int q;
cin >> q;
while(q --) {
pair <int, int> start, end;
cin >> start.first >> start.second;
cin >> end.first >> end.second;
start.first --;
start.second --;
end.first --;
end.second --;
vector <vector <int>> ans(n + 1, vector <int> (m + 1, 0));
ans[start.first][start.second] = 1;
for(int i = start.first; i <= end.first; i ++) {
for(int j = start.second; j <= end.second; j ++){
ans[i][j + 1] = max(ans[i][j], ans[i][j + 1]);
if(a[i][j] == 2) {
ans[i+1][j] = max(ans[i][j], ans[i + 1][j]);
}
}
}
if(ans[end.first][end.second] == 1) cout << "Yes\n";
else cout << "No\n";
end:;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int Q = 1;
//cin >> Q;
while (Q --) {
solve();
}
return 0;
}
Compilation message
trampoline.cpp: In function 'void solve()':
trampoline.cpp:38:3: warning: label 'end' defined but not used [-Wunused-label]
38 | end:;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
788 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
7 ms |
592 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
9 ms |
696 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
51720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2118 ms |
931412 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
815 ms |
1048580 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
505 ms |
1048580 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |