This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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][C]; // subtask 1,2,4
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 or y > y_start)
{
//cout << x << " " << y << " c\n";
if(x != x_start and greens[x-1][y] == 1)
{
x--;
}
else
{
y--;
}
if(y < y_start) break;
}
if(x == x_start and y == y_start)
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |