#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int R, C, N;
cin >> R >> C >> N;
char greens[R+1][C+1]; // subtask 1,2,4
for(int i = 0; i < R; i++)
{
for(int j = 0; j < C; j++)
{
greens[i][j] = 0;
}
}
for(int i = 0; i < N; i++)
{
int x, y;
cin >> x >> y;
greens[x][y] = 1;
}
int T;
cin >> T;
for(int i = 0; i < T; i++)
{
int x_start, y_start, x_end, y_end;
cin >> x_start >> y_start >> x_end >> y_end;
int x = x_end;
int y = y_end;
while(x > x_start and y >= y_start)
{
//cout << x << " " << y << " c\n";
if(greens[x-1][y] == 1)
{
x--;
}
else
{
y--;
}
if(y < y_start) break;
}
if(x == x_start and y_end >= y_start)
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
1 ms |
348 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
1 ms |
348 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
6548 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
30 ms |
6488 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
22 ms |
600 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
31 ms |
6488 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
546 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
515 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
497 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |