Submission #920980

#TimeUsernameProblemLanguageResultExecution timeMemory
920980gelastropodTrampoline (info1cup20_trampoline)C++14
0 / 100
2053 ms55224 KiB
#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"; } }
#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...