Submission #488045

#TimeUsernameProblemLanguageResultExecution timeMemory
488045maks007Trampoline (info1cup20_trampoline)C++14
73 / 100
2073 ms21560 KiB
#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)

trampoline.cpp: In function 'void solve()':
trampoline.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 0; i < temp.size(); i ++) {
      |                 ~~^~~~~~~~~~~~~
#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...