#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int R, C, N, a, b, prev = -1, val = -1, T, c, d, tem;
cin >> R >> C >> N;
vector<int> compr;
set<int> finding;
map<int, int> revCompr;
vector<set<int>> green;
set<pair<int, int>> queued;
bool done = false;
for (int i = 0; i < N; i++)
{
cin >> a >> b;
a--, b--;
queued.insert(pair<int, int>(b, a));
finding.insert(a);
}
auto iter = queued.begin();
for (int i = 0; i < N; i++)
{
if (iter->first != prev)
{
prev = iter->first;
compr.push_back(prev);
val++;
revCompr[prev] = val;
green.push_back(set<int>());
}
green[val].insert(iter->second);
iter++;
}
cin >> T;
for (int i = 0; i < T; i++)
{
done = false;
cin >> a >> b >> c >> d;
a--, b--, c--, d--;
tem = b;
b = a;
a = tem;
tem = d;
d = c;
c = tem;
if (a > c || b > d)
{
cout << "No\n";
continue;
}
while (b != d && a <= c)
{
if (finding.lower_bound(b) == finding.end() || *finding.lower_bound(b) != b)
{
cout << "No\n";
done = true;
break;
}
if (green[revCompr[b]].lower_bound(a) == green[revCompr[b]].end())
{
cout << "No\n";
done = true;
break;
}
a = *green[revCompr[b]].lower_bound(a);
b++;
}
if (done)
continue;
if (a > c)
cout << "No\n";
else
cout << "Yes\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
1372 KB |
expected NO, found YES [7th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
248 ms |
22744 KB |
expected NO, found YES [290th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
792 ms |
47596 KB |
expected YES, found NO [4th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
1628 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2053 ms |
55224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |