제출 #1123180

#제출 시각아이디문제언어결과실행 시간메모리
1123180PwoTrampoline (info1cup20_trampoline)C++17
73 / 100
2096 ms24308 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int r, c, n; cin >> r >> c >> n; set<int> dis; pair<int, int> a[n]; for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; dis.insert(a[i].first); } vector<int> v; v.assign(dis.begin(), dis.end()); unordered_map<int, int> mp; for (int i = 0; i < v.size(); i++) mp[v[i]] = i; set<int> st[v.size()]; for (int i = 0; i < n; i++) { st[mp[a[i].first]].insert(a[i].second); } int t; cin >> t; while (t--) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (x1 == x2 && y2 >= y1) { cout << "Yes\n"; continue; } if (x2 < x1 || y2 < y1 || mp.find(x1) == mp.end() || mp.find(x2 - 1) == mp.end()) { cout << "No\n"; continue; } x1 = mp[x1], x2 = mp[x2 - 1]; int cur = y1; bool b = 1; for (int i = x1; i <= x2; i++) { auto it = st[i].lower_bound(cur); if (it == st[i].end()) { b = 0; break; } cur = *it; if (cur > y2) { b = 0; break; } } cout << (b ? "Yes\n" : "No\n"); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...