# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488045 | maks007 | Trampoline (info1cup20_trampoline) | C++14 | 2073 ms | 21560 KiB |
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;
void solve() {
int r, c;
cin >> r >> c;
int n;
cin >> n;
vector <pair<int, int>> temp;
map <int, vector <int>> mp;
for(int i = 0; i < n; i ++) {
int a, b;
cin >> a >> b;
a --;
b --;
#define pb push_back
temp.pb({a, b});
}
sort(temp.begin(), temp.end());
for(int i = 0; i < temp.size(); i ++) {
mp[temp[i].first].push_back(temp[i].second);
}
int T;
cin >> T;
while(T --) {
pair <int, int> start, end;
cin >> start.first >> start.second >> end.first >> end.second;
start.first --;
start.second --;
end.first --;
end.second --;
int x1 = start.first;
int y1 = start.second;
int x2 = end.first;
int y2 = end.second;
while(x1 != x2) {
if(mp[x1].empty()) break;
auto temp = lower_bound(mp[x1].begin(), mp[x1].end(), y1);
if(temp == mp[x1].end()) break;
y1 = *temp; x1 ++;
}
if(x1 == x2 and y1 <= y2) cout << "Yes\n";
else cout << "No\n";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int Q = 1;
//cin >> Q;
while (Q --) {
solve();
}
return 0;
}
Compilation message (stderr)
# | 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... |